How do I get the User-Name instead of ID in email notification (html)

Hi Community,

I've created an email notification coupled to a LifeCycle state. The creator of the part has to be mentioned in the notification but I only get the ID.

My HTML: ...${created_by_id}...

How can I change the ID to User-Name? I want to get it as easy as possible inside the E-Mail Message Item.

Thanks in advance for your help.

Dave

  • Hi Dave,

    The variables that you're using inside of the E-Mail Message item fields basically represent XPath expressions to the data you're looking for. With this in mind, I'd recommend first just running a simple AML query on your Part to see what the format of the result is and what information you have access to. This should help you better figure out how to access the name of the creator of the Part. If you're new to Aras or just unfamiliar with AML, I'd recommend checking out our intro blog post

    In this case, we just want to run a simple get on our Part to see what the result looks like. I've included a sample AML request below on a test part in one of my local instances. Note that I've used an intentionally specific select attribute to keep the size of the result down for demonstration purposes.

    AML:

    <AML>
        <Item type="Part" action="get" select="created_by_id">
            <item_number>My Part</item_number>
        </Item>
    </AML>

    Result:

    <Item type="Part" typeId="4F1AC04A2B484F3ABA4E20DB63808A88" id="5AC23F6FFDCF4F7C83A88DC04CBD50A0">
        <created_by_id keyed_name="Terry Adams" type="User">18DF23B3851D4C9FA1B96E9CF1F585A8</created_by_id>
        <id keyed_name="My Part" type="Part">5AC23F6FFDCF4F7C83A88DC04CBD50A0</id>
        <itemtype>4F1AC04A2B484F3ABA4E20DB63808A88</itemtype>
    </Item>

    As we can see from the results, it looks like we can access the name of the creator through the keyed_name attribute of the created_by_id property. Using XPath, you can get the value of an attribute by using an expression that ends with /@attribute_name. In this case, if you can access the ID of the creator using ${created_by_id}, you should be able to access the name of the creator using ${created_by_id/@keyed_name}.


    Chris

    Christopher GIllis

    Aras Labs Software Engineer

  • Hi Chris,

    thank you for your competent and detailed answer. It worked at the first try

    Regards,

    Dave