charlynn.stubbert | Posts: 3

Relating a transaction to a custom object and saving completed docs to the custom object

1 votes

In my current setup, I have a main custom object with two buttons: "Generate Contract" and "Send For Sign Off". The first button uses Conga Composer to generate the contract document and saves it to the main custom object. The second button creates the transaction pragmatically and navigate the user to the transaction record.

I want to relate transactions to my custom main object. I've tried populating the parentid field but I get an "Invalid Parent Id" error message. What are the steps to relate a transaction to a custom object record pragmatically?

Additionally, when the transaction is completed, I want to save the signed document against the related main custom object. How should I go about achieving that?


cbowsher | Posts: 3

Reply to: Relating a transaction to a custom object and saving completed docs to the custom object

0 votes

any luck with an answer for this?


Duo_Liang | Posts: 3776

Reply to: Relating a transaction to a custom object and saving completed docs to the custom object

0 votes

Hi guys,

 

If you are specifying the URL behind the custom button with something similar to below (guide here):

"/apex/esl__package?ParentId={!Account.Id}& Name={!Account.Name}%20Agreement &TemplateID=a0G360000018BdREAU"

Here the "Account" is an out-of-the-box object, so when you use your custom object, have you added "__c" as suffix, which is the API name of this object?

"?ParentId={!CustomObject__c.Id}"

 

Around the question how to pull signed document to the custom object once transaction is completed, we haven't managed to walk through it, but we are trying to follow the path by using "Process Builder", maybe you could look into it and see if this throws some light.

 

Duo

 

 

 


charlynn.stubbert | Posts: 3

Reply to: Relating a transaction to a custom object and saving completed docs to the custom object

0 votes

The button is a custom action using a custom lightning component to parse together the information needed to build the URL. I have an apex controller grabbing the id & Name of the main custom object, customer signer info (first name, last name, email), company signer info (User id), and documentId. I have the conventionId and signer recipient labels stored in labels. All of this is passed to the JS controller where the information is put together as a string and an navigate to URL event is fired using that string.

so given that the response is a success and none of the fields are null.

var resp = response.getReturnValue();

var parentObjectId = resp.id;

var documentName = resp.Name + " Contract";

var docId = resp.DocId__c;

var signingConventions = $A.get("$Label.c.Contract_Signing_Convention");

var Signer1Id = resp.Customer_Email__c;

var Signer1FirstName = resp.Customer_FirstName__c;

var Signer1LastName = resp.Customer_LastName__c;

var Signer1Label = $A.get("$Label.c.Customer_Signer_Label");

var Signer2Id = resp.Company_Signer__c;

var Signer2Label = $A.get("$Label.c.Company_Signer_Label");

        var packageParameters = "ParentId="+parentObjectId

        +"&Name="+documentName
        +"&Documents="+docId
        +"&ConventionId="+signingConvention 
        +"&Signer1="+Signer1Id
        +"&Signer1FirstName="+Signer1FirstName
        +"&Signer1LastName="+Signer1LastName
        +"&Signer1Label="+Signer1Label
        +"&Signer1AllowDelegation=0"
        +"&retUrl=%2F"+parentObjectId
        +"&Signer2="+Signer2Id
        +"&Signer2Label="+Signer2Label        
        +"&Signer2AllowDelegation=1"
        +"&EnforceSigningOrder=true&AutoPrepare=1";
        
        var eUrl= $A.get("e.force:navigateToURL");
        eUrl.setParams({
            "url": '/apex/esl__package?'+packageParameters 
        });
        eUrl.fire();

No errors occur in the apex controller or JS controller and all the information is correct (I console logged each variable to verify the expected values where coming through). The url reroutes the the transaction screen but the error message "Invalid Parent Id" occurs. If the ParentId parameter is removed from the string, the error does not occur and we get the edit transaction screen with all the expected info - Signers are there with the correct recipient labels, the correct document is attached, the Convention lookup is populated, etc.

 

Are there any steps that need to be completed to relate a transaction to my main custom object? Do I need to create a Lookup(MainCustomObject__c) field on the transaction object? Do I need to define any other parameters in the URL string?


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