Hi
I am trying to update a field in salesforce and its a custom field in FD I am only able to get that field when I am using cf_merchant_id_3202350 but field name is cf_merchant_id please tell me why and how to get this number
if (args[‘data’][‘ticket’][‘group_id’] == ‘1082000658705’) {
try {
const response = await fetch('https://razorpay--produat.sandbox.my.salesforce.com/services/oauth2/token', options);
const data = await response.json();
console.log(data);
let access_token = 'Bearer ' + data.access_token;
console.log(data.access_token);
await updateSalesforceRecord(access_token, args);
} catch (error) {
console.log('error at ', error);
}
async function updateSalesforceRecord(access_token, args) {
try {
console.log('ard' + args['data']['ticket']['id']);
let options = {
method: 'PATCH',
headers: {
Authorization: access_token,
'Content-Type': 'application/json;charset=UTF-8'
},
body: JSON.stringify({
Status__c: args['data']['ticket']['status'],
MID__c: args['data']['ticket']['custom_fields']['cf_merchant_id'],
})
};
console.log(`https://razorpay--produat.sandbox.my.salesforce.com/services/data/v55.0/sobjects/Tech_Support_Ticket__c/FreshDesk_Ticket_Number__c/${args['data']['ticket']['id']}`);
console.log(options);
const updateResponse = await fetch(`https://razorpay--produat.sandbox.my.salesforce.com/services/data/v58.0/sobjects/Tech_Support_Ticket__c/FreshDesk_Ticket_Number__c/${args['data']['ticket']['id']}`, options);
console.log(updateResponse);
const updateData = await updateResponse.json();
console.log('Update Response', updateData);
} catch (error) {
console.log('Error updating Salesforce record', error);
}
}
}