S
Shiva Duriseati
Guest
Hi Iram, As you mentioned just supplying the base64 value to the createRecord will not resolve the problem we need to use setBinaryFieldValue API. Example: Lets say we have two objects 'A' and 'B' Object A has file upload field and assume that we need to read that file and store it in Object 'B' on creation of every record in 'A' create an object script trigger which will read b64 from uploaded file and set that value to a text field in object 'B' In object 'B' create a dummy text field to store b46 value and also a trigger of type object script which will read binary data from dummy text field and set that value to file upload field in object B. Following are the triggers(Object script) written in both A and B respectively Trigger in 'A' var binaryData=rbv_api.getBinaryData("A", {!id}, "Upload_File"); rbv_api.createRecord("B", {'name':'{!name#text}','Dummy_Text_':binaryData}); Trigger in 'B var binaryValue=rbv_api.getFieldValue('B', {!id}, 'Dummy_Text_'); if(binaryValue!==null){ rbv_api.setBinaryFieldValue('B', {!id}, 'Upload', binaryValue, "image/jpg", "Somefile.jpg"); } Note: You can make additional changes to trigger B for setting file of any time and applicable name(I have hardcoded file name here.) Attaching app.xml for you reference. For your second point calling server side API from client side is not possible. (Please visit the site to view this file) Regards, Shiva
Continue reading...
Continue reading...