This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DEVELOPERS FORUM - Embedding an 'Item' in a web address / URL

eric_h - Thursday, September 29, 2011 12:49 PM:

I was wondering if there was a way to embed an 'Item' in a web address / URL. The idea being that you could email someone a link that would open directly to that item. Usage cases could be part numbers you wanted to share, or for an change (ECO, etc.) activity notification, you could include a direct link to the change item in the notification email.

From what I can tell, this is not possible or at least is not being done. The one place I see HTTP GET variables being used is for login parameters (e.g. '?username=admin').

Any thoughts?

Thanks,

Eric



aponceot - Thursday, September 29, 2011 1:00 PM:

Hi Eric !

 

Yes, there is a possibility to do that. > http://[server]/[innovator]/Client/default.aspx?StartItem=[itemtype]:[id]

For more details, just have a look to http://www.aras.comhttp://www.aras.com/Community/forums/p/416/1169.aspx

 

 



eric_h - Thursday, September 29, 2011 1:43 PM:

Thanks Anthony! That is just what I needed. Looks like it is loosely defined and therefore extensible to user defined item types, etc. This is great - thanks a lot.

Eric



eric_h - Thursday, September 29, 2011 4:16 PM:

Anthony (or anyone else),

I just tested and it works great for item types. I just had another idea, but in addition to including a link the the change item (e.g. ?StartItem=simple%20eco:B7D...), it would be *really* cool if I could also include a link to the voting dialog for that specific 'Workflow Process Activity' that triggered the email to be sent.

If it were possible, the user could click the change link to review the change, and then click the activity link to access the voting dialog. The voting dialog is its own HTML/ASPX files and not like other forms. I kind of tried to make it work but so far no success. I actually have some issues with the voting dialog box (can't style to match my default CSS changes, but may be able to alter the HTML/ASPX file and also sometimes the dialog size ends up being too small.) Anyway, there is room for improvement here and maybe I can figure some things out. But a direct link would be a nice feature.

Thanks again for the pointer,

Eric



aponceot - Thursday, September 29, 2011 5:07 PM:

Adding a link to the vote dialog directly in the email could be a bad idea, because, people could be tempted to directly vote without reviewing the Item. 

What you can do is put a link on the Item form that says "VOTE NOW" by calling a javascript that pops the vote dialog : 

 window.showModalDialog(top.aras.getScriptsURL() + "InBasket/InBasket-VoteDialog.aspx", params, 'resizable:1; scroll:1; dialogHeight:400px; dialogWidth:700px; status:0; help:0');

with params : 

                        var params = new Object();

                        params.aras = top.aras;

                        params.activity = top.aras.getItemById("Activity", actID, 1);

                        params.wflName = wfpName;

                        params.wflId = wfpID;

                        params.assignmentId = asmntID;

                        params.itemId = itemID

You can see a example of that in the SignOff Report that enables that functionnality.



eric_h - Thursday, September 29, 2011 5:13 PM:

That's even better (for reasons you state.) Thanks Anthony!!



eric_h - Friday, September 30, 2011 5:40 PM:

I got this (link in email) *mostly* to work. I did find a little issue. In the case of item types that contain spaces (e.g. Simple ECO in this case), the link does not replace the space with the '%20' that is required in a link/URL:

 

Because of this, the link is not simply click-able by the end user from their email notification. Here is the code/template I used to create the link:

Link: aras/.../default.aspx

 

I don't fully get the template language, but I think it is XPath from syntax and training docs. I tried to find some sort of regex function for XPath, and found something called 'fn:replace'. The problem is, all examples seem to call it from XSLT, and the email template language seems to by straight XPath but not XSLT (I am sort of guessing this based on using the report stuff.)

Maybe I am wrong, and I'll keep looking and trying things. But if anyone knows how to do a regex here that replaces spaces with '%20' as required by URLs let me know.

Thanks,

Eric



eric_h - Friday, September 30, 2011 5:46 PM:

One possible problem, if in fact 'fn:replace' is the answer:

It appears that the above regular expression replace function is part of XPath 2.0, and I have a feeling the components that Aras are built upon only support XPath 1.0.

Any help appreciated.

Thanks!

Eric



eric_h - Monday, October 3, 2011 12:27 PM:

I think I should be able to take it from here. I have not found the ideal solution, but have made it workable. Here is some potentially good information:

.NET 2.0 XPath functions (you can drill up the tree for other good XML info):

http://msdn.microsoft.com/en-us/library/ms256138%28v=VS.80%29.aspx

 

Also, I realized I didn't need do use the functions in XSLT, but could use in my XPath query. 'replace()' would work great, but is only part of XPath 2.0 and does not seem to be supported in .NET 2.0. There is a 'translate()' function, but that appears to only replace a single character with a single character, so will not suffice.

This was sort of a hack/kludge, but proved I could use the functions. I'll need to come up with something better that is more flexible. Right now my emails are getting sent only via two word item types, so it works:

...default.aspx?StartItem=${concat(substring-before(Item[2]/@type, ' '), '%20', substring-after(Item[2]/@type, ' '))}:${Item[2]/@id}

 

Eric



aponceot - Monday, October 3, 2011 12:36 PM:

You could also change the name of your Item Type by replacing the space with an underscore.

If you do that make sure that no Method is using the name of the Item Type in  get, create or update queries.



eric_h - Monday, October 3, 2011 12:51 PM:

Thanks Anthony. I thought earlier about the same thing, but because I am dealing with some core item types I don't want to mess with the names. Another option would be to copy the email message and create a custom version for say single word item types. What I have is pretty workable for now and the coolest part is I learned a little in regards to XPath functions.

The big thing is knowing it is possible to create direct links like that, so thanks for the pointer and link to the earlier forum post!

Eric