Retrieve an attribute in a UPDATE feature with initRule

Resolved

Hello,

I have an organization update feature for the attribute "leaderEmailAddress" which is always valued on an organization object.

My problem is that I need and want to display the actual value of the attribute of the object (Like we do for some tenant with activationUntil / from).

Question : What is the context of an initRule in an update feature ?

OBJECT.xxx doesn't work ->

Here is what I've tried to do :

<options>
    <formLabelOnTop>false</formLabelOnTop>
    <initialization>
        <initRule>
            <script><![CDATA[
                LOG.debug("organization-common-reSendNotifications - leaderEmailAddress {}",OBJECT.leaderEmailAddress)
                final def attributes = []
                attributes.add(AttributeValue.from("status", OBJECT.leaderEmailAddress))
                new ApiObject(attributes)
                ]]></script>
        </initRule>
    </initialization>
    <pendingOperationBehaviour>WARN</pendingOperationBehaviour>
    <submit>
        <reportDisplay>HIDE_ALL</reportDisplay>
    </submit>
</options>

<options>
    <formLabelOnTop>false</formLabelOnTop>
    <initialization>
        <attributes>
            <entry>
                <key>leaderEmailAddress</key>
            </entry>
        </attributes>
        <initRule>
            <script><![CDATA[
                LOG.debug("organization-common-reSendNotifications - leaderEmailAddress {}",OBJECT.leaderEmailAddress)
                final def attributes = []
                attributes.add(AttributeValue.from("status", OBJECT.leaderEmailAddress))
                new ApiObject(attributes)
                ]]></script>
        </initRule>
    </initialization>
    <pendingOperationBehaviour>WARN</pendingOperationBehaviour>
    <submit>
        <reportDisplay>HIDE_ALL</reportDisplay>
    </submit>
</options>
<options>
    <formLabelOnTop>false</formLabelOnTop>
    <initialization>
        <initRule>
            <script><![CDATA[
                LOG.debug("organization-common-reSendNotifications - leaderEmailAddress {}", OBJECT.leaderEmailAddress)
                return new ApiObject([
                        AttributeValue.from("leaderEmailAddress", OBJECT.leaderEmailAddress)
                ])
                ]]></script>
        </initRule>
    </initialization>
    <pendingOperationBehaviour>WARN</pendingOperationBehaviour>
    <submit>
        <reportDisplay>HIDE_ALL</reportDisplay>
    </submit>
</options>

And I also added the attributes in the operations tag in the xml file to test :


<attributes>
    <attribute>leaderEmailAddress</attribute>
</attributes>

No more information because I don't think the tags(qualifying, structural etc) on the company type or the attribute configuration has an importance in my case.

I just think that my approach for this case is wrong, do you have any idea of how can I do it ?

Thank you

Other
2 replies
Best reply by Alan DAYI

ANSWER : don't need to do anything (no initialization), the update feature automatically puts the initial value (found by DAMIEN)

View original