You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

Create Contract from Opportunity

edited Aug 3, 2021 3:43PM in Sales 1 comment

Summary

Create Contract from Opportunity

Content

I was able to create a Contract record from Opportunity using the groovy script below. However, I hardcoded the value of 'ContractTypeId' and 'LegalEntityId' to be able to create contract successfully.

Is there a way to get the ContractTypeId and LegalEntityId via groovy script while in Opportunity object? 

 

try{
  def contractName = Name;
  def contractTypeId = '2411235611232';
  def currencyCode = CurrencyCode;
  def legalEntityId = '1130123121232';
  def partyId = Organization?.PartyId;
  def orgId = PrimaryOrganizationId; //Business Unit Id
  
  def createContractRequest =
[Cognomen : contractName,
ContractTypeId : contractTypeId,
CurrencyCode : currencyCode,
LegalEntityId : legalEntityId,
PartyId : partyId,
OrgId : orgId,
]
 
println("Create Contract Request: "+createContractRequest);
def response = adf.webServices.CreateContract.POST(createContractRequest);
Tagged:

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!