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

Parents
  • 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

Reply Children
No Data