how to get current URL in Email message context

Hello, 

In email message, I would like to push for user an Shortcut of Linked ITEM. Like that it will be easier for user to Access to ITEM.

I know how to get ID if ITEM : I0215_CMEcu:xxxxxx

 

But how to get current URL in Email message context ?

Example : http://aras-dv4...........fr/2as/?StartItem=i0215_CMEcu:58E855AE3EDD42F59639B7FD916FDDF3

  • Hi Breton

    I don't find an easier way to get the URL of an item but you can use the below steps as workaround. You can create a generic method that create the URL and return to your method

    Step 1: Create a Server Side (C#) Method  and copy below code - Method Name : generateURL

    Innovator inn = this.getInnovator();
    string itemType = this.getProperty("itemType");
    string itemId = this.getProperty("itemId");
    string protocol = HttpContext.Current.Request.Url.Scheme;
    string hostName = HttpContext.Current.Request.Url.Host;
    string dbName = HttpContext.Current.Request.Url.Segments[1];
    Item outputUrl = inn.newItem("");
    outputUrl.setProperty("itemurl", protocol + "://" + hostName + "/" + dbName + "?StartItem=" + itemType + ":"+itemId);
    return outputUrl;

    If you want URL of an item in Client Method (Javascript) then use below lines in your method

    var getURL = innovator.newItem("Method","generateURL");
    getURL.setProperty("itemType", parent.thisItem.getType());
    getURL.setProperty("itemId",parent.thisItem.getID());
    getURL = getURL.apply();
    var itemURL = getURL.getProperty("itemurl");

    If you want URL of an item in Server Method (C#) then use below lines in your method

    Item getURL = this.getInnovator().newItem("Method","generateURL");
    getURL.setProperty("itemType", this.getType());
    getURL.setProperty("itemId", this.getID());
    getURL = getURL.apply();
    string itemURL = getURL.getProperty("itemurl");

    Thank You

    Gopikrishnan R

  • Hello, thanks a lot. :-)

    I 'm going to check it today.
    FB

  • Breton,

    Good day.  This is how I have my EMail Message notifications set up.  It provides a link to the task for a change.  I have these assigned to the Activity Template > Notifications on the Workflow.  I set the event to On Activate and Target All Assigned.  I designed the e-mail to be generic so I could assign them to any of the Activities without having to change the notification.

    Subject

    ARAS - ${Item[2]/sm_weapon_system_name} - ${Item[3]/label}: ${Item[@type="Activity"]/name} -  ${Item[2]/item_number} - ${Item[2]/title}

    Body HTML

    <body><font-size=”+1”>
    <p>A ${Item[3]/label} is ready for review. Please log in to ARAS and navigate to My Innovator/My InBasket to take the appropriate actions.</p>

    <p><b>${Item[3]/label}: <a href=eide-aras.myngc.com/.../default.aspx


    <b>Due Date: </b>${Item[2]/due_date}<br/>
    <b>Assigned To: </b>${Item[2]/drafter}<br>
    <b>Affected Item: </b>${Item[2]/affected_item}<br>
    <b>Title: </b>${Item[2]/title}<br/>
    <b>Change Description: </b>${Item[2]/description}</p>

    <p><b>Activity: </b>${Item[@type="Activity"]/name}<br/>
    <b>Instructions: </b>${Item[@type="Activity"]/message}</p>

    <p><a href="">eide-aras.myngc.com/.../default.aspx InBasket Link</b></a></p>

    <br>
    <p>If any assistance is required, please contact the SMORS CM Team.<br>
    - smorscm@ngc.com<br>
    - <a href="">eide.myngc.com/.../Home.aspx CM Page<a></p>

    <br>
    <p>Thank you!</p>
    </body>

    Query String
    <Item type="Activity" id="${Item/ActivityId}" action="get" select="name,message"/>
    <Item type="${Item/@type}" id="${Item/@id}" action="get" select="item_number,title,due_date,drafter,classification,sm_weapon_system_name,description"/>
    <Item type="ItemType" id="${Item/@typeId}" action="get" select="label,name"/>
  • Hello, Thanks a lot.
    I will test it..when I will have some time.
    But this is a good proposal !

    FB

  • Hi community,

    I wonder if anyone in the meanwhile found a "perfect" solution for relative URLs in Email Message items? The ideas mentioned in this thread all help to improve the situation. But maybe there are other options that we don´t know yet?

    @Gopi: Your variant is great for Methods! For JS even a simpler solution is available: var url = aras.getInnovatorUrl(); Smiley

    But is it possible to use the Method or any kind of code in Email Messages?

    I tried to find something helpful in the codetree, but it seems that emailing is part of the core itself. Best solution would be some additional Variable, just like $[USER] or $[ALIAS].