Skip to main content

We are trying to expire Contract OoS lines where the contract still continues, but has been ended for a specific line, through the API. 

This works fine manually, but when trying to set this through the API, we get the error message:

Error Message:: You selected an Expiration Date that exceeds the length of the original contract.  The new Expiration Date should fall between the contract Start Date and the current Expiration Date.

This is despite the fact that the date that I am specifying falls between the start and end date for both the contract header and the contract line.

Am I doing something wrong? Formatting the date incorrectly?

<root>
    <session email="" alias="">
        <state bc_name="CustomerContract">
            <action name="declare">
                <attribute dtype="int" in_var="" out_var="" name="ccontlID" value="" />
            </action>
            <action name="getdescrtableex">
                <attribute out_var="ccontlID" table_name="ccontl" element_name="ccontl_id" search_criteria="item_id = '489593' and cconth_id = 'N-296376'" default_value="" />
            </action>
            <action name="data">
                <main>
                    <row number="1">
                        <to_date in_var="" out_var="">
                            <!tCDATA/2023-01-01]]>
                        </to_date>
                    </row>
                </main>
            </action>
        </state>
    </session>
</root>

 

 

Hi Chris,

You need to specify the Contract ID in the main and retrieve the appropriate contract line before able to update the expiry date.
However, there are a number of validations will apply, i.e: there are existing orders covered by the contract line ..etc

Below is the revised API sample:

<root>
    <session email="" alias="">
        <state bc_name="CustomerContract">
            <action name="declare">
                <attribute dtype="int" in_var="" out_var="" name="ccontlID" value="" />
            </action>
            <action name="getdescrtableex">
                <attribute out_var="ccontlID" table_name="ccontl" element_name="ccontl_id" search_criteria="item_id = '489593' and cconth_id = 'N-296376'" default_value="" />
            </action>
            <action name="data">
                <main>
                    <row number="1">
                        <cconth_id>N-296376</cconth_id>
                    </row>
                </main>
                <ccontrl_xref use_retrieve_limit="true">
                    <row number="1">
                        <ccontl_id dtype="string" in_var="ccontlID">in_var</ccontl_id>
                        <to_date dtype="date">2023-01-01</to_date>
                        <bo_search_keys>
                            <item>
                                <name>ccontl_id</name>
                                <value in_var="ccontlID">in_var</value>
                            </item>
                        </bo_search_keys>
                    </row>
                </ccontrl_xref>
            </action>
        </state>
    </session>
</root>

 

Note:
Please always follow rules when updating contract via API. Using improper API command sets may break the contract data integration.
General rule is: if you cannot update a column manually via UI, you must NOT update the column via API. 

 

Regards,

Joshua


Hi Joshua

Thank you! I figured the ccontl_id would be enough. I will give it a go :)

 

Appreciate the addendum hahaha. We've certainly learned our lesson there.


@Joshua Liem 
Is there any way to bypass this condition when updating through the API?
 

 


Hi Chris,

 

Please add below update in main section to suppress the validation.

 

<cc_is_from_update_contr>Y</cc_is_from_update_contr>


Reply