--- title: "Post Agreement Deactivate" slug: "post-agreement-deactivate" description: "Run a script to execute custom actions when users deactivate an agreement." updated: 2026-06-02T13:21:37Z published: 2026-06-02T13:21:37Z canonical: "docs.zilliant.com/post-agreement-deactivate" --- > ## 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 Deactivate ## Purpose Allows you to run a script to execute custom actions when users [deactivate an agreement](/main/docs/manage-published-agreements#deactivate-agreements). > [!NOTE] > Example use case > > Your company uses an external system to manage customer-specific agreement prices. To push agreed prices to that system when users publish an agreement, configure the [Post Agreement Quote Publish](/main/docs/post-agreement-quote-publish) Groovy extension point. To automatically update or remove those prices when users deactivate an agreement, configure the **Post Agreement Deactivate** extension point. ## Setup Upload the script for **Post Agreement Deactivate**. For details about uploading and configuring Groovy scripts, read [Upload a Groovy script](/main/docs/upload-a-groovy-script). ## Binding variables In addition to the [common binding variables](/main/docs/binding-variables), the following binding variables are available for this extension point. | Variable name | Class | Description | | --- | --- | --- | | agreement | Agreement | Represents the published 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. | 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 [deactivate an agreement](/main/docs/manage-published-agreements#deactivate-agreements). If you use the `agreement` and `agreementHeader` variables in the script to modify the agreement data, the system applies changes to the agreement object associated with the published agreements. If no script is uploaded for this extension point, the system deactivates agreements without additional actions. ## 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 // Script purpose: Modify Agreement objectName, Header, and Double Policy Values System.out.println('=== Script Execution: Agreement Deactivate Started ===') // Agreement section def agreementObjectName = agreement.getAgreementDataAttributeValue( Schema.objectName.getUriAsString() ) System.out.println('Agreement URI: ' + agreement.getAgreementURI()) System.out.println('Agreement Object Name: ' + agreementObjectName) agreement.setAgreementDataAttribute( Schema.objectName.getUriAsString(), agreementObjectName + ' - Deactivate' ) System.out.println('→ Added suffix "Deactivate" in Agreement objectName') System.out.println('--- Agreement Section Completed ---') // AgreementHeader section System.out.println('=== Script Execution: AgreementHeader Started ===') def agreementHeaderObjectName = agreementHeader.getAgreementHeaderDataAttributeValue( Schema.objectName.getUriAsString() ) def agreementHeaderStartDate = agreementHeader.getAgreementHeaderDataAttributeValue(Schema.agreementHeaderStartDate.getUriAsString()) def agreementHeaderEndDate = agreementHeader.getAgreementHeaderDataAttributeValue(Schema.agreementHeaderEndDate.getUriAsString()) System.out.println('AgreementHeader Object Name: ' + agreementHeaderObjectName) System.out.println('AgreementHeader Start Date: ' + agreementHeaderStartDate) System.out.println('AgreementHeader End Date: ' + agreementHeaderEndDate) agreementHeader.setAgreementHeaderDataAttribute( Schema.objectName.getUriAsString(), agreementHeaderObjectName + ' - Deactivate' ) System.out.println('→ Added suffix "Deactivate" in AgreementHeader objectName') System.out.println('--- AgreementHeader Section Completed ---') // AgreementLine policy update System.out.println('=== Doubling the Policy Value at All Levels of AgreementLine: Started ===') for (AgreementLine agreementLine : agreementHeader.getAgreementLines()) { doublePolicyValue(agreementLine) } // Helper method: double policy value recursively void doublePolicyValue(AgreementLine agreementLine) { def position = agreementLine.getAgreementLineDataAttributeValue(Schema.agreementLinePosition.getUriAsString()) def policyValue = agreementLine.getAgreementLinePolicyValue() def newPolicyValue = 2 * policyValue agreementLine.setAgreementLineDataAttribute( Schema.agreementLinePolicyValue.getUriAsString(), newPolicyValue ) System.out.println("Policy Value at position ${position}: Prev=${policyValue}, Now=${newPolicyValue}") List childLines = agreementLine.getAgreementLines() for (AgreementLine child : childLines) { doublePolicyValue(child) } } System.out.println('=== Doubling the Policy Value at All Levels of AgreementLine: Completed ===') // Script end System.out.println('=== Script Execution: Agreement Deactivate Completed ===') return agreement ```