Create Contract from Opportunity
Summary
Create Contract from OpportunityContent
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:
2