sstickler1286

Registering New Document Programmatically in Salesforce

0 votes

We are implementing new functionality related to Proctors (document type) and we need to create a new declaration. In the process, created new Document_Proctor like Declaration_FYLSX, however we are facing issues with new document. This is in UAT.

Do we need to register Blob# or Name at your end as it says Bad Request? Please advise.

 

Below are the errors:

 

New document: Declaration_Proctor

 

10:10:23:593 USER_DEBUG [244]|DEBUG|StaticResource:{Id=0813R000000CdhXQAS, Body=Blob[14151]}

 

10:10:23:173 USER_DEBUG [231]|DEBUG|=> Response from createPackageExample: F8sF_hpz_100v5a7tQd6FBe63rs=

 

Line: 738, Column: 1

OneSpanRESTAPIHelper.OneSpanRestAPIHelperException: Error creating OneSpan package with documents:

400 - Bad Request - {"code":400,"technical":"Unexpected Content-Disposition value for parameter 'name'",

"messageKey":"error.validation.invalidParameters","message":"Invalid parameters.","name":"Validation Error"}

 

Existing Declaratiom_FYLSX:

 

10:13:49:470 USER_DEBUG [231]|DEBUG|=> Response from createPackageExample: 1T18amg-U1iZPvav1Qznlf5tGfQ=

 

10:13:50:029 USER_DEBUG [244]|DEBUG|StaticResource:{Id=081t00000008XLAAA2, Body=Blob[34561]}

 

No Error


Approved Answer

Reply to: Registering New Document Programmatically in Salesforce

0 votes

Hi Sam,

 

From the error message "Unexpected Content-Disposition value for parameter 'name'"", it sounds like the raw request format might have some problem.

What's the document type (PDF, Word, etc.) associated to this custom object? What if you associated with another file? Which SDK function the code uses to upload the document?

 

Duo

 

 

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: Registering New Document Programmatically in Salesforce

0 votes

Yes, the name is causing the issue, we have introduced new document with name Declaration_Proctor. The new document has been defined in a similar fashion as earlier ones and new name is not associated with any other file. Below is the method we are invoking for document creation.

 

Could you please check if there are any restrictions or naming conventions to follow to get successful response.

 


Reply to: Registering New Document Programmatically in Salesforce

0 votes

Hi Sam,

 

I see, these Word files are stored as StaticResource in Salesforce. I've seen the same error in a few recent cases(case1case2, case3). Although I can't reproduce the same in my test environment, but there are two proposed solution:
(1)Try to convert the Word file to PDF and reupload the static resource.

(2)There's another way to create package and add document in a single API call, which should resolve this error:
 

        OneSpanSDK sdk = new OneSpanSDK();
         
        //Create package
        OneSpanAPIObjects.Package_x pkg = new OneSpanAPIObjects.Package_x();
        pkg.name = 'Example Transaction - ' + Datetime.now().format();
        pkg.status = OneSpanAPIObjects.PackageStatus.SENT;
        
        //Create Roles
        String roleId1 = 'Signer1';
        OneSpanAPIObjects.Role role1 = new OneSpanAPIObjects.Role();
        role1.signers = sdk.createRolesSigner('John', 'Smith', '[email protected]', 'CEO', 'ABC Bank');
        role1.id = roleId1;
        role1.name = roleId1;
        pkg.roles = new List<OneSpanAPIObjects.Role>{role1};    //add role

        
        //Prepare Documents Blob
        String document1Name = 'Document1';
        StaticResource sr = [SELECT Id, Body FROM StaticResource WHERE Name = 'testdoc1' LIMIT 1];
        Map<String,Blob> documentBlobMap = new Map<String,Blob>();
        documentBlobMap.put(document1Name, sr.Body);
         
        //Create Document Metadata
        OneSpanAPIObjects.Document document1 = new OneSpanAPIObjects.Document();
        document1.name = document1Name;
        document1.id = document1Name;
        
        OneSpanAPIObjects.Field field = new OneSpanAPIObjects.Field();
        field.left = 208;
        field.width = 200;
        field.height = 50;
        field.top = 518;
        field.page = 0;
        field.subtype = 'CAPTURE';
        field.type = 'SIGNATURE';
         
        List<OneSpanAPIObjects.Field> fields = new List<OneSpanAPIObjects.Field>();
        fields.add(field);
         
        OneSpanAPIObjects.Approval approval = new OneSpanAPIObjects.Approval();
        approval.fields = fields;
        approval.role = roleId1;


        List<OneSpanAPIObjects.Approval> approvals = new List<OneSpanAPIObjects.Approval>();
        approvals.add(approval);
        document1.approvals = approvals;


        pkg.documents = new List<OneSpanAPIObjects.Document>{document1};    //add document
        
        //Send package One Step
        String packageId = sdk.createPackage(pkg,documentBlobMap);
        System.debug('PackageId: ' + packageId);

 

Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: Registering New Document Programmatically in Salesforce

0 votes

Hi Duo ;

 

They had some success but now they are getting the error I uploaded as an image - Trusted Type Policy creation blocked by Content Security policy


Reply to: Registering New Document Programmatically in Salesforce

0 votes

Hi Sam,

 

Unfortunately, I am not aware of this pendor.js script. Could you elaborate the nature of the issue a little bit, like what's the behavior you are experiencing and what steps to reproduce the issue?

 

Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: Registering New Document Programmatically in Salesforce

0 votes

Issue: After loading one span URL data on the LWC component(Iframe) and click on the page, we are getting below highlighted error from pendo.js file (see previous file we uploaded which is a javascript file from OneSpan package.

 

Is it possible to schedule a call you?


Reply to: Registering New Document Programmatically in Salesforce

0 votes

Hi Sam,

 

I saw this error message in developer console even if I directly launched the signing URL in a new tab, see attachment. Let me check if this is a known issue or you can go ahead and create a support ticket reporting this. (However I doubt this error will affect the normal signing flow)

 

Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Attachments
23-9-26.png98.93 KB

Reply to: Registering New Document Programmatically in Salesforce

0 votes

Hi Duo;

 

They would like to schedule a call with you but I am guessing you want to check on whether this is a known issue first. Pleased advise.

 

Thanks!!


Reply to: Registering New Document Programmatically in Salesforce

0 votes

Hi Sam,

 

Yes, I've checked the previous tickets and this is a known issue. Please fill in a support ticket and have the issue reported.

 

Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off