salesforce-service-cloudazure-data-factory

Pass Job ID dynamically in Azure Data Factory's Web activity


I am working on Salesforce Bulk API where I am able to Create Job and upload data to Salesforce successfully. Now I want to send a GET request to Salesforce and get job status but in URl field of web activity I am trying to pass the JOB ID from previous web activity and it is not working since Salesforce converts its 15 digit ID to 18 digit ID when it sends it over to Azure Data Factory. I am trying to contcat the url along with the Job ID but at the same time strip the last 3 characters.

ex: URL:http://test.salesforce.com/data/v42.0/job/ingest/ JOBID: 01fr6745gh00000AAF (dynamically add this from previous activity, 'activity.output.id')

Output I want: http://test.salesforce.com/data/v42.0/job/ingest/01fr6745gh00000. I want to pass this in the Web activity URL field.

I am not sure if this is possible or how to achieve this. Any help will be much appreciated.

Thanks,


Solution

  • You can use length() function to get your id's length, then use substring(id,0,length-3) function to get your expected id. Finally concat your URL and id.

    Something like this expression:

    @concat('http://test.salesforce.com/data/v42.0/job/ingest/ ',substring(activity('name').output.id,0,sub(length(activity('name').output.id),3)))