Question

I'm modifying the alert template for when an task item is assigned.

This section here

<HTML>
  <![CDATA[<td class="toolbarbutton"><a href="]]>
</HTML>
<GetVar Name="ItemUrl" URLEncodeAsURL="TRUE" />
<HTML><![CDATA[">$Resources:Alerts_link_view; ]]></HTML>
<GetVar Name="ItemName" HTMLEncode="TRUE" />
<HTML>
  <![CDATA[</a></td><td class="toolbarsep">|</td>]]>
</HTML>

Render out in the email as

<td class="toolbarbutton">
  <a href="http://localhost/test/Lists/Tasks/Dispform.aspx?ID=1">View Task One</a>
</td>
<td class="toolbarsep">|</td>

Is there anyway in CAML so that the href goes instead to

../Lists/Tasks/Editform.aspx?ID=1

Basically, I want to manipulate the value coming from
<GetVar Name="ItemUrl" URLEncodeAsURL="TRUE" />

Was it helpful?

Solution

Rather than "manipulate" the 'ItemURL' var, which I don't think is possible, you can build your own URL. Based on the above, I believe you want something like this:

<HTML>
  <![CDATA[<td class="toolbarbutton"><a href="]]>
</HTML>
<GetVar Name="ListUrl" URLEncodeAsURL="TRUE" />
<HTML><![CDATA[/EditForm.aspx?ID=]]></HTML>
<GetVar Name="RawValue#ID" />
<HTML><![CDATA[">]]></HTML>
<GetVar Name="ItemName" HTMLEncode="TRUE" />
<HTML>
  <![CDATA[</a></td><td class="toolbarsep">|</td>]]>
</HTML>

To ensure the ID value comes through, you may also need to remove "ID" from the <ImmediateNotificationExcludedFields> & <DigestNotificationExcludedFields> elements within the Alert Template's <Properties> section.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top