--- title: "Post Agreement Quote Publish" slug: "post-agreement-quote-publish" description: "Use this extension point to run a script to execute custom actions when users publish an accepted agreement." updated: 2026-06-02T13:22:51Z published: 2026-06-02T13:22:51Z canonical: "docs.zilliant.com/post-agreement-quote-publish" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.zilliant.com/llms.txt > Use this file to discover all available pages before exploring further. # Post Agreement Quote Publish ## Purpose Allows you to run a script to execute custom actions when users [publish an accepted agreement](/v1/docs/manage-agreements-under-negotiation#publish-agreements). ## Setup Upload the script for **Post Agreement Quote Publish**. For details about uploading and configuring Groovy scripts, read [Upload a Groovy script](/docs/upload-a-groovy-script). ## Binding variables In addition to the [common binding variables](/docs/binding-variables), the following binding variables are available for this extension point. | Variable name | Class | Description | | --- | --- | --- | | salesItemsTree | SalesItemsTree | Represents the Quote object associated with the agreement under negotiation. Contains functions you can use to query and modify the header and its line items. This variable can’t modify data. Use it only to retrieve information from the associated Quote object. | | agreement | Agreement | Represents the agreement. Contains functions you can use to query and modify the agreement. | | agreementHeader | AgreementHeader | Represents the AgreementHeader object. Contains functions you can use to query and modify the agreement and its line items. | | accountInfo | AccountInfo | Represents the AccountInfo object. Contains details of the linksAgreementAccount. | | accountPFRecords | List`<PartnerFunctionRecord>` | List of PartnerFunctionRecord objects. Represents partner function records of the linked account. | | sourceAgreementPFRecords | Collection`<PartnerFunctionRecord>` | Collection of PartnerFunctionRecord objects. Contains a list of objects representing partner function records of the source Quote object associated with the agreement under negotiation. | For details about the classes listed in this table, including available methods, fields, and method signatures, read the [Zilliant Groovy API reference](/main/docs/groovy-api-reference). ## Expected output No output expected. ## Script execution A script that you upload for this extension point runs automatically when users [publish an accepted agreement](/v1/docs/manage-agreements-under-negotiation#publish-agreements). If you use the `agreement` and `agreementHeader` variables in the script to modify the agreement data, the system applies changes to the agreement. If no script is uploaded for this extension point, the system publishes agreements without additional action. ## Sample script ```groovy // Import necessary classes for the script import com.imc.vocabulary.Schema import com.imc.iss.groovy.agreements.Agreement import com.imc.iss.groovy.agreements.AgreementHeader import com.imc.iss.groovy.agreements.AgreementLine import com.imc.iss.groovy.salesitem.SalesItemsTree import com.imc.iss.groovy.salesitem.SalesItemNode // Start of script for Agreement execution System.out.println('Script Execution Agreement Started') // Fetch Agreement object name and related account URI def agreementObjectName = agreement.getAgreementDataAttributeValue(Schema.objectName.getUriAsString()) def agreementLinksAgreementAccount = agreement.getAgreementRelationAttributeURI(Schema.linksAgreementAccount.getUriAsString()) // Log Agreement details System.out.println('Agreement URI: ' + agreement.getAgreementURI()) System.out.println('Agreement ObjectName: ' + agreementObjectName) System.out.println('Agreement LinksAgreementAccount: ' + agreementLinksAgreementAccount) // Update Agreement object name by adding the '- Agreement' suffix agreement.setAgreementDataAttribute(Schema.objectName.getUriAsString(), agreementObjectName + ' - Agreement') System.out.println('Added suffix agreement in Agreement objectName') // End of Agreement execution section System.out.println('Script Execution Agreement completed') // Start of AgreementHeader execution System.out.println('Script Execution: AgreementHeader Started') // Fetch AgreementHeader object name, start date, and end date def agreementHeaderObjectName = agreementHeader.getAgreementHeaderDataAttributeValue(Schema.objectName.getUriAsString()) def agreementHeaderStartDate = agreementHeader.getAgreementHeaderDataAttributeValue(Schema.agreementHeaderStartDate.getUriAsString()) def agreementHeaderEndDate = agreementHeader.getAgreementHeaderDataAttributeValue(Schema.agreementHeaderEndDate.getUriAsString()) // Log AgreementHeader details System.out.println('AgreementHeader ObjectName: ' + agreementHeaderObjectName) System.out.println('AgreementHeader agreementHeaderStartDate: ' + agreementHeaderStartDate) System.out.println('AgreementHeader agreementHeaderEndDate: ' + agreementHeaderEndDate) // Update the AgreementHeader object name by adding a prefix '- AgreementHeader' agreementHeader.setAgreementHeaderDataAttribute(Schema.objectName.getUriAsString(), agreementHeaderObjectName + ' - AgreementHeader') System.out.println('Added prefix agreementHeader in AgreementHeader objectName') // End of AgreementHeader execution section System.out.println('Script Execution: AgreementHeader Completed') // Start of doubling policy value for all AgreementLine levels System.out.println('Doubling the Policy Value at All Levels of an Agreement Line: Started') // Loop through all AgreementLines in the AgreementHeader and double their policy values for (AgreementLine agreementLine: agreementHeader.getAgreementLines()) {    doublePolicyValue(agreementLine) } // Helper function to recursively double the policy value for each AgreementLine void doublePolicyValue(AgreementLine agreementLine) {    // Fetch the position and policy value of the current AgreementLine    def position = agreementLine.getAgreementLineDataAttributeValue(Schema.agreementLinePosition.getUriAsString())    def policyValue = agreementLine.getAgreementLinePolicyValue()    // Set the new doubled policy value    agreementLine.setAgreementLineDataAttribute(Schema.agreementLinePolicyValue.getUriAsString(), 2 * policyValue)    // Log the original policy value for the current position    System.out.println('Policy Value at ' + position + ' : ' + policyValue)    // Recursively double policy value for child AgreementLines if they exist    List < AgreementLine > agreementLines = agreementLine.getAgreementLines()    for (AgreementLine child: agreementLines) {        doublePolicyValue(child)    } } // End of policy doubling section System.out.println('Doubling the Policy Value at All Levels of an Agreement Line: Completed') // Start of accessing all SalesItem URIs System.out.println('Accessing all SalesItem URIs') // Loop through all SalesItemNodes in the SalesItemsTree and log their URIs for (SalesItemNode salesItemNode: salesItemsTree.getChildren()) {    accessSalesItemURI(salesItemNode) } // Helper function to recursively access and log SalesItem URIs void accessSalesItemURI(SalesItemNode salesItemNode) {    // Log the URI of the current SalesItemNode    System.out.println('URI: ' + salesItemNode.getSalesItemURI())    // Recursively access and log URIs for child SalesItemNodes    List < SalesItemNode > salesItemNodes = salesItemNode.getChildren()    for (SalesItemNode child: salesItemNodes) {        accessSalesItemURI(child)    } } // End of SalesItem URI access section System.out.println('Script Execution Completed') // Return the updated agreement object return agreement ```