You need to sign in to do that
Don't have an account?
Sumant Kuchi 4
box integration api issue
Hi, I recently stepped into SF and working on BOX integration.
Here are the scenarios I used for Box integration.
1) Downloaded box app from appExchange and used two box accounts to setup (I have no clue why do we need user account for developing)
2) followed the instructions what document given.
3) Was uploaded files in box section of an object
But this solution is not sufficient since eveyuser is asked login to grant permissions to create folder
Scenario 2:
1) Downloaded box app from appExchange and used two box accounts to setup (I have no clue why do we need user account for developing)
2) Created custom object which resembles the Attachment object that will replace the standard attachments related list on the page layout.
3) Created VF for file upload page and Controller for that page
4) In the Controller I'll be able to attache files to SF File Storage but I'll not be able to upload to BOX, here is the error and code to box I used.
I would be appreciated if you could get me solution
Here are the scenarios I used for Box integration.
1) Downloaded box app from appExchange and used two box accounts to setup (I have no clue why do we need user account for developing)
2) followed the instructions what document given.
3) Was uploaded files in box section of an object
But this solution is not sufficient since eveyuser is asked login to grant permissions to create folder
Scenario 2:
1) Downloaded box app from appExchange and used two box accounts to setup (I have no clue why do we need user account for developing)
2) Created custom object which resembles the Attachment object that will replace the standard attachments related list on the page layout.
3) Created VF for file upload page and Controller for that page
4) In the Controller I'll be able to attache files to SF File Storage but I'll not be able to upload to BOX, here is the error and code to box I used.
Error: 13:24:15:149 USER_DEBUG [19]|DEBUG|Toolkit:[AUTH_WRAPPER_PREPARE_FAIL_MESSAGE=Unable to use default credentials to make a callout to box (maybe this is in a trigger or constructor): , authWrapper=BoxAuthWrapper:[adminSettings=box__BoxUser_Settings__c:{}, client_id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, client_secret=yyyyyyyyyyyyyyyyyyyyyyyyyyyyyy, redirect_uri=null, resultMessage=, userSettings=box__BoxUser_Settings__c:{}], didAuthChange=false, existingFolderId=null, mostRecentError=, newFolderMetas=(), newFrups=(), newRootFolders=()] Note: I replaced client_id and client_secrets with x and y respectivelyand the box toolkit code I used to upload file..
//@future (callout=true) private void createAttachmentinBox(id attachmentid){ System.debug('In HelperClass'); String BoxFolderid='11476443045'; box.Toolkit boxToolkit = new box.Toolkit(); System.debug('boxtoolkit'+boxToolkit); Attachment Myattachment=[select name,body,parentid from attachment where id=:attachmentid]; System.debug('Attachment '+Myattachment); String fileFromBoxID=boxtoolkit.createFileFromAttachment(Myattachment,null, BoxFolderid,null); System.debug('fileFromBoxID '+fileFromBoxID); boxToolkit.commitChanges(); //delete [select id from Attachment where id=:attachmentid]; }Why am I not able to use default credentials to make a callout to box? Could you get me solition for my issue?
I would be appreciated if you could get me solution
Your code is perfect, try removing the comment before @future (callout=true) and run the trigger.
Let me know if it helps you.
Regards,
Onesh.K
Glad it helped...!
Using @future (callout=true) invokes the box method to upload attachments.(Callout)
To get the Box file URL you have to use REST Api.
Mark it as BEST ANSWER if it helped you, so that it may help others too.
Best Regards,
Onesh.K
Could you send the idea to get the Box file URL you have to use REST Api? That would be really awesome if you could provide details on that.
Sumant K
You will find the button MARK THIS BEST ANSWER. above my answer (The answer which helped you). Just a Click can mark it best answer.
Im looking into Box file URL using REST Api and will post the links ASAP.
Thanks,