Introduction
When TaroWorks mobile users captured photos and signatures in versions previous to TaroWorks 6.1, an attachment was created in Salesforce. If those Form questions were field mapped, a link would be created to point to the uploaded attachment in the mapped URL field. After your upgrade to TaroWorks 6.1, these url fields will still have old links to the previous attachments. The steps in this article will update those fields to point to the corresponding File. You'll need to create a list of all the object API names where TaroWorks has mapped URL fields for photos and signatures. If you haven't mapped any photos or signatures in your org, you can move on to the next article.
Execute Batch Process
- Open the Developer Console.
- Click Debug > Open Execute Anonymous Window.
- Copy and paste the following code snippet into the Developer Console.
- List<String> fieldName = new List<String>{'<Field Names>'};
Id batchJobId = Database.executeBatch(new tw_f_conversion.ReplaceAttachmentReferenceInSobjectBatch('<Object Name>',null, fieldName, null,null,null),200);
- List<String> fieldName = new List<String>{'<Field Names>'};
- Replace all placeholders using the table below.
- EXAMPLE: List<String> fieldName = new List<String>{'Photo__c','Signature_URL__c'};
Id batchJobId = Database.executeBatch(new tw_f_conversion.ReplaceAttachmentReferenceInSobjectBatch('X61test__c','null, fieldName, null,null,null),200);
- EXAMPLE: List<String> fieldName = new List<String>{'Photo__c','Signature_URL__c'};
Placeholder | Value to Enter | Example |
<Object Name> | The API name of the object where you are updating URL fields. | Farm__c |
<Field Names> | Comma delimited string of the API names of the URL fields you want to update in the object | 'Photo_URL__c', 'Signature_URL__c' |
<Created Before Date> | If you want to limit your update by date, you can enter a date variable here. Otherwise, type null. | null |
<Created After Date> | If you want to limit your update by date, you can enter a date variable here. Otherwise, type null. | null |
<sobjectRecordIdsList> | If you only want to update specific records, provide a list of Salesforce ID's here. Otherwise, type null. | null |
5. Click Execute.
6. Verify your URL's have updated.
Conclusion
If any failure occurs, you will get a failure email with attached CSV file detailing the failures. Please submit a support ticket with the failure attachment here.
Now that you have updated the URL fields in your objects, you can continue to 06. Update Page Layouts.
Comments
0 comments
Please sign in to leave a comment.