Discussion:
CRM 4.0 Workflow links
(too old to reply)
Chris Brown
2008-01-17 23:46:04 UTC
Permalink
Hello,

I am needing to have Workflow send an email with a link to given item. For
example if a person is assigned a task, I want the email to contain the link
to the task. I understand how to have it create the email but I do not know
how to have it send the link.

I appreciate the help!

Thanks,

Chris
Sam
2008-01-18 07:53:19 UTC
Permalink
Hi Chris,

This was an issue in 3.0 and i guess it still remains in 4.0 as well. They
have a new option to send shortcut and copy shortcut... this copies the
entire url to current object. But it probably cannot be used in a workflow
automation.

The solution would be to add a custom attribute in the entity and through
scripts have it store the id of the entity. In the workflow, in the email
template you could type the link to your CRM server and then place the
custom attribute to get the id of the entity instance in question.

Hope this helps!

Sam
_______________
Inogic
Innovative Logic
Innovative solutions for your SME ERP/CRM products
E-mail: ***@inogic.com
Web: www.inogic.com
--------------------------
Post by Chris Brown
Hello,
I am needing to have Workflow send an email with a link to given item.
For
example if a person is assigned a task, I want the email to contain the link
to the task. I understand how to have it create the email but I do not know
how to have it send the link.
I appreciate the help!
Thanks,
Chris
Chris Brown
2008-01-18 15:42:01 UTC
Permalink
Hi Sam,

Thanks for the reply. Could you plese give me an example of the Java Script
that would be used to populate the field?

Thanks,

Chris
Post by Sam
Hi Chris,
This was an issue in 3.0 and i guess it still remains in 4.0 as well. They
have a new option to send shortcut and copy shortcut... this copies the
entire url to current object. But it probably cannot be used in a workflow
automation.
The solution would be to add a custom attribute in the entity and through
scripts have it store the id of the entity. In the workflow, in the email
template you could type the link to your CRM server and then place the
custom attribute to get the id of the entity instance in question.
Hope this helps!
Sam
_______________
Inogic
Innovative Logic
Innovative solutions for your SME ERP/CRM products
Web: www.inogic.com
--------------------------
Post by Chris Brown
Hello,
I am needing to have Workflow send an email with a link to given item.
For
example if a person is assigned a task, I want the email to contain the link
to the task. I understand how to have it create the email but I do not know
how to have it send the link.
I appreciate the help!
Thanks,
Chris
Sam
2008-01-19 11:53:56 UTC
Permalink
Hi Chris,

Try this,

//Check if not a new record

if(crmForm.FormType != 1)

{

crmForm.all.new_id.DataValue = crmForm.ObjectId;

//to force crm to save this value

crmForm.all.new_taskurl.ForceSubmit = true;

}

This will store the id of the entity in a custom attribute. You can then use
this in the url for the link to the entity.

HTH

Sam

_______________
Inogic
Innovative Logic
Innovative solutions for your SME ERP/CRM products
E-mail: ***@inogic.com
Web: www.inogic.com
--------------------------
Post by Chris Brown
Hi Sam,
Thanks for the reply. Could you plese give me an example of the Java Script
that would be used to populate the field?
Thanks,
Chris
Post by Sam
Hi Chris,
This was an issue in 3.0 and i guess it still remains in 4.0 as well. They
have a new option to send shortcut and copy shortcut... this copies the
entire url to current object. But it probably cannot be used in a workflow
automation.
The solution would be to add a custom attribute in the entity and through
scripts have it store the id of the entity. In the workflow, in the email
template you could type the link to your CRM server and then place the
custom attribute to get the id of the entity instance in question.
Hope this helps!
Sam
_______________
Inogic
Innovative Logic
Innovative solutions for your SME ERP/CRM products
Web: www.inogic.com
--------------------------
Post by Chris Brown
Hello,
I am needing to have Workflow send an email with a link to given item.
For
example if a person is assigned a task, I want the email to contain the link
to the task. I understand how to have it create the email but I do not know
how to have it send the link.
I appreciate the help!
Thanks,
Chris
Chris Brown
2008-01-20 22:58:02 UTC
Permalink
Hi Sam,

Thanks for the tip. I was able to get the new ID field to populate based on
your java script code. The next problem I have is that when I create the
workflow email, I pretype the link in front of the ID, but when the email is
sent, it doesn't make the ID apart of the email link so the link is broken.
Do you have any suggestions?

Thanks,

Chris
Post by Sam
Hi Chris,
Try this,
//Check if not a new record
if(crmForm.FormType != 1)
{
crmForm.all.new_id.DataValue = crmForm.ObjectId;
//to force crm to save this value
crmForm.all.new_taskurl.ForceSubmit = true;
}
This will store the id of the entity in a custom attribute. You can then use
this in the url for the link to the entity.
HTH
Sam
_______________
Inogic
Innovative Logic
Innovative solutions for your SME ERP/CRM products
Web: www.inogic.com
--------------------------
Post by Chris Brown
Hi Sam,
Thanks for the reply. Could you plese give me an example of the Java Script
that would be used to populate the field?
Thanks,
Chris
Post by Sam
Hi Chris,
This was an issue in 3.0 and i guess it still remains in 4.0 as well. They
have a new option to send shortcut and copy shortcut... this copies the
entire url to current object. But it probably cannot be used in a workflow
automation.
The solution would be to add a custom attribute in the entity and through
scripts have it store the id of the entity. In the workflow, in the email
template you could type the link to your CRM server and then place the
custom attribute to get the id of the entity instance in question.
Hope this helps!
Sam
_______________
Inogic
Innovative Logic
Innovative solutions for your SME ERP/CRM products
Web: www.inogic.com
--------------------------
Post by Chris Brown
Hello,
I am needing to have Workflow send an email with a link to given item.
For
example if a person is assigned a task, I want the email to contain the link
to the task. I understand how to have it create the email but I do not know
how to have it send the link.
I appreciate the help!
Thanks,
Chris
Rob Mottram
2008-01-23 01:50:03 UTC
Permalink
Chris,

I am using CRM 4 and trying to exactly the same thing. I have managed to
make the email like to work in the email, it is all to do with when you add
characters and deleted them.

1. Entered the full web link to the correct aspx page, for example for a
lead it is:

http://CRMSERVER/CRMOrganisation/leads/edit.aspx

2. To add stuff to the end of this I was getting the problem you were
getting, so I placed the cursor between teh p and x of .aspx at the end. I
could then add fields in there and the became part of the link, so added an
extra x, followed by the rest of the link I needed which was:

id={new_ID}#

4. Once this was in I could remove the last x. Make sure you do this be
moving before the last x and using delete, not by using backspace, this make
the system re-check the link.

I hope I managed to explain this correctly and the information helps you.
And thanks to Sam for the first example, it really managed to solve a problem
for us.
Post by Chris Brown
Hi Sam,
Thanks for the tip. I was able to get the new ID field to populate based on
your java script code. The next problem I have is that when I create the
workflow email, I pretype the link in front of the ID, but when the email is
sent, it doesn't make the ID apart of the email link so the link is broken.
Do you have any suggestions?
Thanks,
Chris
Post by Sam
Hi Chris,
Try this,
//Check if not a new record
if(crmForm.FormType != 1)
{
crmForm.all.new_id.DataValue = crmForm.ObjectId;
//to force crm to save this value
crmForm.all.new_taskurl.ForceSubmit = true;
}
This will store the id of the entity in a custom attribute. You can then use
this in the url for the link to the entity.
HTH
Sam
_______________
Inogic
Innovative Logic
Innovative solutions for your SME ERP/CRM products
Web: www.inogic.com
--------------------------
Post by Chris Brown
Hi Sam,
Thanks for the reply. Could you plese give me an example of the Java Script
that would be used to populate the field?
Thanks,
Chris
Post by Sam
Hi Chris,
This was an issue in 3.0 and i guess it still remains in 4.0 as well. They
have a new option to send shortcut and copy shortcut... this copies the
entire url to current object. But it probably cannot be used in a workflow
automation.
The solution would be to add a custom attribute in the entity and through
scripts have it store the id of the entity. In the workflow, in the email
template you could type the link to your CRM server and then place the
custom attribute to get the id of the entity instance in question.
Hope this helps!
Sam
_______________
Inogic
Innovative Logic
Innovative solutions for your SME ERP/CRM products
Web: www.inogic.com
--------------------------
Post by Chris Brown
Hello,
I am needing to have Workflow send an email with a link to given item.
For
example if a person is assigned a task, I want the email to contain the link
to the task. I understand how to have it create the email but I do not know
how to have it send the link.
I appreciate the help!
Thanks,
Chris
Rob Mottram
2008-01-23 09:14:00 UTC
Permalink
Very sorry,

I have done this again on my system and it does not appear to be working
correctly. I am sure it did the first time. I will try again and let you know
if I manage to find a solution.
Post by Sam
Chris,
I am using CRM 4 and trying to exactly the same thing. I have managed to
make the email like to work in the email, it is all to do with when you add
characters and deleted them.
1. Entered the full web link to the correct aspx page, for example for a
http://CRMSERVER/CRMOrganisation/leads/edit.aspx
2. To add stuff to the end of this I was getting the problem you were
getting, so I placed the cursor between teh p and x of .aspx at the end. I
could then add fields in there and the became part of the link, so added an
id={new_ID}#
4. Once this was in I could remove the last x. Make sure you do this be
moving before the last x and using delete, not by using backspace, this make
the system re-check the link.
I hope I managed to explain this correctly and the information helps you.
And thanks to Sam for the first example, it really managed to solve a problem
for us.
Post by Chris Brown
Hi Sam,
Thanks for the tip. I was able to get the new ID field to populate based on
your java script code. The next problem I have is that when I create the
workflow email, I pretype the link in front of the ID, but when the email is
sent, it doesn't make the ID apart of the email link so the link is broken.
Do you have any suggestions?
Thanks,
Chris
Post by Sam
Hi Chris,
Try this,
//Check if not a new record
if(crmForm.FormType != 1)
{
crmForm.all.new_id.DataValue = crmForm.ObjectId;
//to force crm to save this value
crmForm.all.new_taskurl.ForceSubmit = true;
}
This will store the id of the entity in a custom attribute. You can then use
this in the url for the link to the entity.
HTH
Sam
_______________
Inogic
Innovative Logic
Innovative solutions for your SME ERP/CRM products
Web: www.inogic.com
--------------------------
Post by Chris Brown
Hi Sam,
Thanks for the reply. Could you plese give me an example of the Java Script
that would be used to populate the field?
Thanks,
Chris
Post by Sam
Hi Chris,
This was an issue in 3.0 and i guess it still remains in 4.0 as well. They
have a new option to send shortcut and copy shortcut... this copies the
entire url to current object. But it probably cannot be used in a workflow
automation.
The solution would be to add a custom attribute in the entity and through
scripts have it store the id of the entity. In the workflow, in the email
template you could type the link to your CRM server and then place the
custom attribute to get the id of the entity instance in question.
Hope this helps!
Sam
_______________
Inogic
Innovative Logic
Innovative solutions for your SME ERP/CRM products
Web: www.inogic.com
--------------------------
Post by Chris Brown
Hello,
I am needing to have Workflow send an email with a link to given item.
For
example if a person is assigned a task, I want the email to contain the
link
to the task. I understand how to have it create the email but I do not
know
how to have it send the link.
I appreciate the help!
Thanks,
Chris
Sam
2008-01-23 12:01:25 UTC
Permalink
Hi Rob/Chris,

First oppologies for the delay in getting back... was busy with other stuff
and did not check this post until today.

Chris you probably do not get the id set as, the code provided for to set
the new_id field with the object id if it is not a new form. this means that
you will need to click on save twice for the new_id to be populated...

Here is something you could use on the onload of the form

if(crmForm.FormType != 1)
{
if(crmForm.all.new_id.DataValue == null)
{
crmForm.all.new_id.DataValue = crmForm.ObjectId;

or set this directly to the url

crmForm.all.new_url.DataValue = 'http://servername:5555/leads/edit.aspx?id='
+ crmForm.ObjectId;

//Save the change
crmForm.Save();

}

The above code will store the url once the entity has been saved. This will
cause the form to refresh once again.

If you use this custom field to populate the url in the Create workflow...
you will get null values because when the entity is created this field is
not set. It is set after the entity has been saved and an id assigned to it.
So you could do with writing some kind of a wait condition to wait till this
id was populated. And with the code snippet provided above this will happen
immideately after the revord is saved and the form loads again...

Hope this helps!


Sam
_______________
Inogic
Innovative Logic
Innovative solutions for your SME ERP/CRM products
E-mail: ***@inogic.com
Web: www.inogic.com
--------------------------
Post by Rob Mottram
Very sorry,
I have done this again on my system and it does not appear to be working
correctly. I am sure it did the first time. I will try again and let you know
if I manage to find a solution.
Post by Sam
Chris,
I am using CRM 4 and trying to exactly the same thing. I have managed to
make the email like to work in the email, it is all to do with when you add
characters and deleted them.
1. Entered the full web link to the correct aspx page, for example for a
http://CRMSERVER/CRMOrganisation/leads/edit.aspx
2. To add stuff to the end of this I was getting the problem you were
getting, so I placed the cursor between teh p and x of .aspx at the end. I
could then add fields in there and the became part of the link, so added an
id={new_ID}#
4. Once this was in I could remove the last x. Make sure you do this be
moving before the last x and using delete, not by using backspace, this make
the system re-check the link.
I hope I managed to explain this correctly and the information helps you.
And thanks to Sam for the first example, it really managed to solve a problem
for us.
Post by Chris Brown
Hi Sam,
Thanks for the tip. I was able to get the new ID field to populate based on
your java script code. The next problem I have is that when I create the
workflow email, I pretype the link in front of the ID, but when the email is
sent, it doesn't make the ID apart of the email link so the link is broken.
Do you have any suggestions?
Thanks,
Chris
Post by Sam
Hi Chris,
Try this,
//Check if not a new record
if(crmForm.FormType != 1)
{
crmForm.all.new_id.DataValue = crmForm.ObjectId;
//to force crm to save this value
crmForm.all.new_taskurl.ForceSubmit = true;
}
This will store the id of the entity in a custom attribute. You can then use
this in the url for the link to the entity.
HTH
Sam
_______________
Inogic
Innovative Logic
Innovative solutions for your SME ERP/CRM products
Web: www.inogic.com
--------------------------
Post by Chris Brown
Hi Sam,
Thanks for the reply. Could you plese give me an example of the
Java
Script
that would be used to populate the field?
Thanks,
Chris
Post by Sam
Hi Chris,
This was an issue in 3.0 and i guess it still remains in 4.0 as
well.
They
have a new option to send shortcut and copy shortcut... this copies the
entire url to current object. But it probably cannot be used in a workflow
automation.
The solution would be to add a custom attribute in the entity and through
scripts have it store the id of the entity. In the workflow, in the email
template you could type the link to your CRM server and then place the
custom attribute to get the id of the entity instance in question.
Hope this helps!
Sam
_______________
Inogic
Innovative Logic
Innovative solutions for your SME ERP/CRM products
Web: www.inogic.com
--------------------------
Post by Chris Brown
Hello,
I am needing to have Workflow send an email with a link to given item.
For
example if a person is assigned a task, I want the email to contain the
link
to the task. I understand how to have it create the email but I do not
know
how to have it send the link.
I appreciate the help!
Thanks,
Chris
Rob Mottram
2008-01-23 12:14:01 UTC
Permalink
Hi I was just writing this when I noticed you had replied!

I have been trying to get this to work this morning, and have found out part
of the answer, and I can get the solution to work in CRM 3 but not in CRM 4.
If you create a URL field, and populate this with the full URL required for
the link. This field can then be added to the email in the workflow, and this
will make a link. The problem is that in CRM 4 there are not being made as
HTML links, just text so cannot be clicked on.

Here is a link to a page which explains the solution, which works perfectly
for CRM 3.
http://blogs.inetium.com/blogs/microsoftcrm/archive/2007/06/27/embedding-direct-links-to-crm-in-a-workflow-email.aspx

I am in contact with Microsoft support as to why URL Links don't appear to
be correct in CRM 4, once I have some more information I will let you know.
Post by Sam
Hi Rob/Chris,
First oppologies for the delay in getting back... was busy with other stuff
and did not check this post until today.
Chris you probably do not get the id set as, the code provided for to set
the new_id field with the object id if it is not a new form. this means that
you will need to click on save twice for the new_id to be populated...
Here is something you could use on the onload of the form
if(crmForm.FormType != 1)
{
if(crmForm.all.new_id.DataValue == null)
{
crmForm.all.new_id.DataValue = crmForm.ObjectId;
or set this directly to the url
crmForm.all.new_url.DataValue = 'http://servername:5555/leads/edit.aspx?id='
+ crmForm.ObjectId;
//Save the change
crmForm.Save();
}
The above code will store the url once the entity has been saved. This will
cause the form to refresh once again.
If you use this custom field to populate the url in the Create workflow...
you will get null values because when the entity is created this field is
not set. It is set after the entity has been saved and an id assigned to it.
So you could do with writing some kind of a wait condition to wait till this
id was populated. And with the code snippet provided above this will happen
immideately after the revord is saved and the form loads again...
Hope this helps!
Sam
_______________
Inogic
Innovative Logic
Innovative solutions for your SME ERP/CRM products
Web: www.inogic.com
--------------------------
Post by Rob Mottram
Very sorry,
I have done this again on my system and it does not appear to be working
correctly. I am sure it did the first time. I will try again and let you know
if I manage to find a solution.
Post by Sam
Chris,
I am using CRM 4 and trying to exactly the same thing. I have managed to
make the email like to work in the email, it is all to do with when you add
characters and deleted them.
1. Entered the full web link to the correct aspx page, for example for a
http://CRMSERVER/CRMOrganisation/leads/edit.aspx
2. To add stuff to the end of this I was getting the problem you were
getting, so I placed the cursor between teh p and x of .aspx at the end. I
could then add fields in there and the became part of the link, so added an
id={new_ID}#
4. Once this was in I could remove the last x. Make sure you do this be
moving before the last x and using delete, not by using backspace, this make
the system re-check the link.
I hope I managed to explain this correctly and the information helps you.
And thanks to Sam for the first example, it really managed to solve a problem
for us.
Post by Chris Brown
Hi Sam,
Thanks for the tip. I was able to get the new ID field to populate based on
your java script code. The next problem I have is that when I create the
workflow email, I pretype the link in front of the ID, but when the email is
sent, it doesn't make the ID apart of the email link so the link is broken.
Do you have any suggestions?
Thanks,
Chris
Post by Sam
Hi Chris,
Try this,
//Check if not a new record
if(crmForm.FormType != 1)
{
crmForm.all.new_id.DataValue = crmForm.ObjectId;
//to force crm to save this value
crmForm.all.new_taskurl.ForceSubmit = true;
}
This will store the id of the entity in a custom attribute. You can then use
this in the url for the link to the entity.
HTH
Sam
_______________
Inogic
Innovative Logic
Innovative solutions for your SME ERP/CRM products
Web: www.inogic.com
--------------------------
Post by Chris Brown
Hi Sam,
Thanks for the reply. Could you plese give me an example of the
Java
Script
that would be used to populate the field?
Thanks,
Chris
Post by Sam
Hi Chris,
This was an issue in 3.0 and i guess it still remains in 4.0 as
well.
They
have a new option to send shortcut and copy shortcut... this copies the
entire url to current object. But it probably cannot be used in a
workflow
automation.
The solution would be to add a custom attribute in the entity and
through
scripts have it store the id of the entity. In the workflow, in
the email
template you could type the link to your CRM server and then place the
custom attribute to get the id of the entity instance in question.
Hope this helps!
Sam
_______________
Inogic
Innovative Logic
Innovative solutions for your SME ERP/CRM products
Web: www.inogic.com
--------------------------
Post by Chris Brown
Hello,
I am needing to have Workflow send an email with a link to given
item.
For
example if a person is assigned a task, I want the email to
contain the
link
to the task. I understand how to have it create the email but I
do not
know
how to have it send the link.
I appreciate the help!
Thanks,
Chris
Chris Brown
2008-01-24 10:36:02 UTC
Permalink
Hi Sam,

I was able to get the email link to work based upon your script and embeding
the link in the field on the entity. Outlook automatically creates a
hyperlink from the url string. The only problem I am running into now is
that when a task is created via workflow, I guess that workflow bypasses the
java script and does not get the link added to the task, so there is not link
to be sent.

Do you have any more suggestions?

Thanks again for all your help!
Post by Sam
Hi Rob/Chris,
First oppologies for the delay in getting back... was busy with other stuff
and did not check this post until today.
Chris you probably do not get the id set as, the code provided for to set
the new_id field with the object id if it is not a new form. this means that
you will need to click on save twice for the new_id to be populated...
Here is something you could use on the onload of the form
if(crmForm.FormType != 1)
{
if(crmForm.all.new_id.DataValue == null)
{
crmForm.all.new_id.DataValue = crmForm.ObjectId;
or set this directly to the url
crmForm.all.new_url.DataValue = 'http://servername:5555/leads/edit.aspx?id='
+ crmForm.ObjectId;
//Save the change
crmForm.Save();
}
The above code will store the url once the entity has been saved. This will
cause the form to refresh once again.
If you use this custom field to populate the url in the Create workflow...
you will get null values because when the entity is created this field is
not set. It is set after the entity has been saved and an id assigned to it.
So you could do with writing some kind of a wait condition to wait till this
id was populated. And with the code snippet provided above this will happen
immideately after the revord is saved and the form loads again...
Hope this helps!
Sam
_______________
Inogic
Innovative Logic
Innovative solutions for your SME ERP/CRM products
Web: www.inogic.com
--------------------------
Post by Rob Mottram
Very sorry,
I have done this again on my system and it does not appear to be working
correctly. I am sure it did the first time. I will try again and let you know
if I manage to find a solution.
Post by Sam
Chris,
I am using CRM 4 and trying to exactly the same thing. I have managed to
make the email like to work in the email, it is all to do with when you add
characters and deleted them.
1. Entered the full web link to the correct aspx page, for example for a
http://CRMSERVER/CRMOrganisation/leads/edit.aspx
2. To add stuff to the end of this I was getting the problem you were
getting, so I placed the cursor between teh p and x of .aspx at the end. I
could then add fields in there and the became part of the link, so added an
id={new_ID}#
4. Once this was in I could remove the last x. Make sure you do this be
moving before the last x and using delete, not by using backspace, this make
the system re-check the link.
I hope I managed to explain this correctly and the information helps you.
And thanks to Sam for the first example, it really managed to solve a problem
for us.
Post by Chris Brown
Hi Sam,
Thanks for the tip. I was able to get the new ID field to populate based on
your java script code. The next problem I have is that when I create the
workflow email, I pretype the link in front of the ID, but when the email is
sent, it doesn't make the ID apart of the email link so the link is broken.
Do you have any suggestions?
Thanks,
Chris
Post by Sam
Hi Chris,
Try this,
//Check if not a new record
if(crmForm.FormType != 1)
{
crmForm.all.new_id.DataValue = crmForm.ObjectId;
//to force crm to save this value
crmForm.all.new_taskurl.ForceSubmit = true;
}
This will store the id of the entity in a custom attribute. You can then use
this in the url for the link to the entity.
HTH
Sam
_______________
Inogic
Innovative Logic
Innovative solutions for your SME ERP/CRM products
Web: www.inogic.com
--------------------------
Post by Chris Brown
Hi Sam,
Thanks for the reply. Could you plese give me an example of the
Java
Script
that would be used to populate the field?
Thanks,
Chris
Post by Sam
Hi Chris,
This was an issue in 3.0 and i guess it still remains in 4.0 as
well.
They
have a new option to send shortcut and copy shortcut... this copies the
entire url to current object. But it probably cannot be used in a
workflow
automation.
The solution would be to add a custom attribute in the entity and
through
scripts have it store the id of the entity. In the workflow, in
the email
template you could type the link to your CRM server and then place the
custom attribute to get the id of the entity instance in question.
Hope this helps!
Sam
_______________
Inogic
Innovative Logic
Innovative solutions for your SME ERP/CRM products
Web: www.inogic.com
--------------------------
Post by Chris Brown
Hello,
I am needing to have Workflow send an email with a link to given
item.
For
example if a person is assigned a task, I want the email to
contain the
link
to the task. I understand how to have it create the email but I
do not
know
how to have it send the link.
I appreciate the help!
Thanks,
Chris
Rob Mottram
2008-01-24 10:54:01 UTC
Permalink
I was expecting outlook to make it a link for me as well, but for some reason
it is not doing it on our system. This could be due to settings in outlook at
the moment the reason we need this has gone, but I think I am going to have
to get this working at somepoint.

I realised I might get the same issue as you at somepoint, which is that the
task does not have an ID until AFTER it has been saved. This means that the
ID field can only be populated the second time it is opened.
The other options I can think of would involve creating an assembly to
lookup the ID. This could either be run after create of the task and put the
ID into a field, or be called from the workflow to look up the ID each time
it is needed.
I have not yet had a chance to create any assemblies in CRM 4, but must look
at it soon, and expect this will be simple.
Post by Chris Brown
Hi Sam,
I was able to get the email link to work based upon your script and embeding
the link in the field on the entity. Outlook automatically creates a
hyperlink from the url string. The only problem I am running into now is
that when a task is created via workflow, I guess that workflow bypasses the
java script and does not get the link added to the task, so there is not link
to be sent.
Do you have any more suggestions?
Thanks again for all your help!
Post by Sam
Hi Rob/Chris,
First oppologies for the delay in getting back... was busy with other stuff
and did not check this post until today.
Chris you probably do not get the id set as, the code provided for to set
the new_id field with the object id if it is not a new form. this means that
you will need to click on save twice for the new_id to be populated...
Here is something you could use on the onload of the form
if(crmForm.FormType != 1)
{
if(crmForm.all.new_id.DataValue == null)
{
crmForm.all.new_id.DataValue = crmForm.ObjectId;
or set this directly to the url
crmForm.all.new_url.DataValue = 'http://servername:5555/leads/edit.aspx?id='
+ crmForm.ObjectId;
//Save the change
crmForm.Save();
}
The above code will store the url once the entity has been saved. This will
cause the form to refresh once again.
If you use this custom field to populate the url in the Create workflow...
you will get null values because when the entity is created this field is
not set. It is set after the entity has been saved and an id assigned to it.
So you could do with writing some kind of a wait condition to wait till this
id was populated. And with the code snippet provided above this will happen
immideately after the revord is saved and the form loads again...
Hope this helps!
Sam
_______________
Inogic
Innovative Logic
Innovative solutions for your SME ERP/CRM products
Web: www.inogic.com
--------------------------
Post by Rob Mottram
Very sorry,
I have done this again on my system and it does not appear to be working
correctly. I am sure it did the first time. I will try again and let you know
if I manage to find a solution.
Post by Sam
Chris,
I am using CRM 4 and trying to exactly the same thing. I have managed to
make the email like to work in the email, it is all to do with when you add
characters and deleted them.
1. Entered the full web link to the correct aspx page, for example for a
http://CRMSERVER/CRMOrganisation/leads/edit.aspx
2. To add stuff to the end of this I was getting the problem you were
getting, so I placed the cursor between teh p and x of .aspx at the end. I
could then add fields in there and the became part of the link, so added an
id={new_ID}#
4. Once this was in I could remove the last x. Make sure you do this be
moving before the last x and using delete, not by using backspace, this make
the system re-check the link.
I hope I managed to explain this correctly and the information helps you.
And thanks to Sam for the first example, it really managed to solve a problem
for us.
Post by Chris Brown
Hi Sam,
Thanks for the tip. I was able to get the new ID field to populate based on
your java script code. The next problem I have is that when I create the
workflow email, I pretype the link in front of the ID, but when the email is
sent, it doesn't make the ID apart of the email link so the link is broken.
Do you have any suggestions?
Thanks,
Chris
Post by Sam
Hi Chris,
Try this,
//Check if not a new record
if(crmForm.FormType != 1)
{
crmForm.all.new_id.DataValue = crmForm.ObjectId;
//to force crm to save this value
crmForm.all.new_taskurl.ForceSubmit = true;
}
This will store the id of the entity in a custom attribute. You can
then use
this in the url for the link to the entity.
HTH
Sam
_______________
Inogic
Innovative Logic
Innovative solutions for your SME ERP/CRM products
Web: www.inogic.com
--------------------------
Post by Chris Brown
Hi Sam,
Thanks for the reply. Could you plese give me an example of the
Java
Script
that would be used to populate the field?
Thanks,
Chris
Post by Sam
Hi Chris,
This was an issue in 3.0 and i guess it still remains in 4.0 as
well.
They
have a new option to send shortcut and copy shortcut... this
copies the
entire url to current object. But it probably cannot be used in a
workflow
automation.
The solution would be to add a custom attribute in the entity and
through
scripts have it store the id of the entity. In the workflow, in
the email
template you could type the link to your CRM server and then place
the
custom attribute to get the id of the entity instance in question.
Hope this helps!
Sam
_______________
Inogic
Innovative Logic
Innovative solutions for your SME ERP/CRM products
Web: www.inogic.com
--------------------------
Post by Chris Brown
Hello,
I am needing to have Workflow send an email with a link to given
item.
For
example if a person is assigned a task, I want the email to
contain the
link
to the task. I understand how to have it create the email but I
do not
know
how to have it send the link.
I appreciate the help!
Thanks,
Chris
Sam
2008-01-24 11:17:08 UTC
Permalink
Hi Chris,

I did anticipate this issue you might have and this is the explanation and
had put that in...

If you use this custom field to populate the url in the Create workflow...
you will get null values because when the entity is created this field is
not set. It is set after the entity has been saved and an id assigned to it.
So you could do with writing some kind of a wait condition to wait till this
id was populated. And with the code snippet provided above this will happen
immideately after the revord is saved and the form loads again...

So the change would have to made at the workflow level... put a wait
condition for entity condition and choose new_url contains data.. or is not
null... so ti will wait till the url field has been populated and this will
happen immideately upon reload... after the save.

HTH

Sam
_______________
Inogic
Innovative Logic
Innovative solutions for your SME ERP/CRM products
E-mail: ***@inogic.com
Web: www.inogic.com
--------------------------
Post by Chris Brown
Hi Sam,
I was able to get the email link to work based upon your script and embeding
the link in the field on the entity. Outlook automatically creates a
hyperlink from the url string. The only problem I am running into now is
that when a task is created via workflow, I guess that workflow bypasses the
java script and does not get the link added to the task, so there is not link
to be sent.
Do you have any more suggestions?
Thanks again for all your help!
Post by Sam
Hi Rob/Chris,
First oppologies for the delay in getting back... was busy with other stuff
and did not check this post until today.
Chris you probably do not get the id set as, the code provided for to set
the new_id field with the object id if it is not a new form. this means that
you will need to click on save twice for the new_id to be populated...
Here is something you could use on the onload of the form
if(crmForm.FormType != 1)
{
if(crmForm.all.new_id.DataValue == null)
{
crmForm.all.new_id.DataValue = crmForm.ObjectId;
or set this directly to the url
crmForm.all.new_url.DataValue =
'http://servername:5555/leads/edit.aspx?id='
+ crmForm.ObjectId;
//Save the change
crmForm.Save();
}
The above code will store the url once the entity has been saved. This will
cause the form to refresh once again.
If you use this custom field to populate the url in the Create workflow...
you will get null values because when the entity is created this field is
not set. It is set after the entity has been saved and an id assigned to it.
So you could do with writing some kind of a wait condition to wait till this
id was populated. And with the code snippet provided above this will happen
immideately after the revord is saved and the form loads again...
Hope this helps!
Sam
_______________
Inogic
Innovative Logic
Innovative solutions for your SME ERP/CRM products
Web: www.inogic.com
--------------------------
Post by Rob Mottram
Very sorry,
I have done this again on my system and it does not appear to be working
correctly. I am sure it did the first time. I will try again and let
you
know
if I manage to find a solution.
Post by Sam
Chris,
I am using CRM 4 and trying to exactly the same thing. I have managed to
make the email like to work in the email, it is all to do with when
you
add
characters and deleted them.
1. Entered the full web link to the correct aspx page, for example for a
http://CRMSERVER/CRMOrganisation/leads/edit.aspx
2. To add stuff to the end of this I was getting the problem you were
getting, so I placed the cursor between teh p and x of .aspx at the
end.
I
could then add fields in there and the became part of the link, so
added
an
id={new_ID}#
4. Once this was in I could remove the last x. Make sure you do this be
moving before the last x and using delete, not by using backspace,
this
make
the system re-check the link.
I hope I managed to explain this correctly and the information helps you.
And thanks to Sam for the first example, it really managed to solve a problem
for us.
Post by Chris Brown
Hi Sam,
Thanks for the tip. I was able to get the new ID field to populate based on
your java script code. The next problem I have is that when I
create
the
workflow email, I pretype the link in front of the ID, but when the email is
sent, it doesn't make the ID apart of the email link so the link is broken.
Do you have any suggestions?
Thanks,
Chris
Post by Sam
Hi Chris,
Try this,
//Check if not a new record
if(crmForm.FormType != 1)
{
crmForm.all.new_id.DataValue = crmForm.ObjectId;
//to force crm to save this value
crmForm.all.new_taskurl.ForceSubmit = true;
}
This will store the id of the entity in a custom attribute. You
can
then use
this in the url for the link to the entity.
HTH
Sam
_______________
Inogic
Innovative Logic
Innovative solutions for your SME ERP/CRM products
Web: www.inogic.com
--------------------------
Post by Chris Brown
Hi Sam,
Thanks for the reply. Could you plese give me an example of the
Java
Script
that would be used to populate the field?
Thanks,
Chris
Post by Sam
Hi Chris,
This was an issue in 3.0 and i guess it still remains in 4.0 as
well.
They
have a new option to send shortcut and copy shortcut... this
copies the
entire url to current object. But it probably cannot be used in a
workflow
automation.
The solution would be to add a custom attribute in the entity and
through
scripts have it store the id of the entity. In the workflow, in
the email
template you could type the link to your CRM server and then
place
the
custom attribute to get the id of the entity instance in question.
Hope this helps!
Sam
_______________
Inogic
Innovative Logic
Innovative solutions for your SME ERP/CRM products
Web: www.inogic.com
--------------------------
Post by Chris Brown
Hello,
I am needing to have Workflow send an email with a link to given
item.
For
example if a person is assigned a task, I want the email to
contain the
link
to the task. I understand how to have it create the email but I
do not
know
how to have it send the link.
I appreciate the help!
Thanks,
Chris
unknown
2008-09-11 08:50:19 UTC
Permalink
Hi;
I recently read this thread and see the problems with automatically adding the entity id when creating a case, opporunity, contact etc.
Here is code for a workflow plugin for getting the guid of an incident. It can easily be modified to use other entities. Once completed simply create a workflow and reference this custom workflow plugin from it. I wish I could say it was all my own work but I just changed the code a bit from Aamir Bashir’s CRM blog
-much thanks to him for doing most of the work.

using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Collections;
using System.Drawing;
using System.Workflow.ComponentModel.Compiler;
using System.Workflow.ComponentModel.Serialization;
using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Design;
using System.Workflow.Runtime;
using System.Workflow.Activities;
using System.Workflow.Activities.Rules;
using Microsoft.Crm.Sdk;
using Microsoft.Crm.SdkTypeProxy;
using Microsoft.Crm.Workflow;
using Microsoft.Crm.Workflow.Activities;
using Microsoft.Crm.Sdk.Query;

namespace EntityURL
{
[CrmWorkflowActivity("Add ID to Case URL field")]

public partial class Activity1 : SequenceActivity
{

protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
{


IContextService contextService = (IContextService)executionContext.GetService(typeof(IContextService));

IWorkflowContext context = contextService.Context;

ICrmService crmService = context.CreateCrmService();

WhoAmIRequest systemUserRequest = new WhoAmIRequest();

WhoAmIResponse systemUser = (WhoAmIResponse)crmService.Execute(systemUserRequest);

ColumnSet cols = new ColumnSet();
//Getting the ID of entity which unqiue itself

Guid guidID = new Guid(this.objectID.Value.ToString());

// i am using “{” before GUID and "}" after.This field will hold the GUID of account

String Number = "{" + guidID + "}";

TargetRetrieveIncident target = new TargetRetrieveIncident();


target.EntityId = guidID;
RetrieveRequest getIncident = new RetrieveRequest();

getIncident.ReturnDynamicEntities = true;

getIncident.Target = target;

getIncident.ColumnSet = new AllColumns();

RetrieveResponse retrieved = (RetrieveResponse)crmService.Execute(getIncident);

DynamicEntity regardingIncident = (DynamicEntity)retrieved.BusinessEntity;
//I am using custom field to hold the value of “GUID” .

if (regardingIncident.Properties.Contains("ba_entityurl"))
{

regardingIncident.Properties["ba_entityurl"] = Number;

}

else
{

regardingIncident.Properties.Add(new StringProperty("ba_entityurl", Number));
}

crmService.Update(regardingIncident);


return ActivityExecutionStatus.Closed;

}


public static DependencyProperty objectIDProperty = DependencyProperty.Register("objectID", typeof(Lookup), typeof(Activity1));



[CrmInput("objectID")]

[CrmReferenceTarget("incident")]


public Lookup objectID
{

get
{

return (Lookup)base.GetValue(objectIDProperty);

}

set
{

base.SetValue(objectIDProperty, value);

}
}

}
}
Teena Mishra
2011-02-03 21:35:40 UTC
Permalink
Thank You Rob, that helped!

Teena
Post by Chris Brown
Hello,
I am needing to have Workflow send an email with a link to given item. For
example if a person is assigned a task, I want the email to contain the link
to the task. I understand how to have it create the email but I do not know
how to have it send the link.
I appreciate the help!
Thanks,
Chris
Post by Sam
Hi Chris,
This was an issue in 3.0 and i guess it still remains in 4.0 as well. They
have a new option to send shortcut and copy shortcut... this copies the
entire url to current object. But it probably cannot be used in a workflow
automation.
The solution would be to add a custom attribute in the entity and through
scripts have it store the id of the entity. In the workflow, in the email
template you could type the link to your CRM server and then place the
custom attribute to get the id of the entity instance in question.
Hope this helps!
Sam
_______________
Inogic
Innovative Logic
Innovative solutions for your SME ERP/CRM products
Web: www.inogic.com
--------------------------
Post by Chris Brown
Hi Sam,
Thanks for the reply. Could you plese give me an example of the Java Script
that would be used to populate the field?
Thanks,
Chris
Post by Sam
Hi Chris,
Try this,
//Check if not a new record
if(crmForm.FormType != 1)
{
crmForm.all.new_id.DataValue = crmForm.ObjectId;
//to force crm to save this value
crmForm.all.new_taskurl.ForceSubmit = true;
}
This will store the id of the entity in a custom attribute. You can then use
this in the url for the link to the entity.
HTH
Sam
_______________
Inogic
Innovative Logic
Innovative solutions for your SME ERP/CRM products
Web: www.inogic.com
--------------------------
Post by Chris Brown
Hi Sam,
Thanks for the tip. I was able to get the new ID field to populate based on
your java script code. The next problem I have is that when I create the
workflow email, I pretype the link in front of the ID, but when the email is
sent, it doesn't make the ID apart of the email link so the link is broken.
Do you have any suggestions?
Thanks,
Chris
Post by Sam
Chris,
I am using CRM 4 and trying to exactly the same thing. I have managed to
make the email like to work in the email, it is all to do with when you add
characters and deleted them.
1. Entered the full web link to the correct aspx page, for example for a
http://CRMSERVER/CRMOrganisation/leads/edit.aspx
2. To add stuff to the end of this I was getting the problem you were
getting, so I placed the cursor between teh p and x of .aspx at the end. I
could then add fields in there and the became part of the link, so added an
id={new_ID}#
4. Once this was in I could remove the last x. Make sure you do this be
moving before the last x and using delete, not by using backspace, this make
the system re-check the link.
I hope I managed to explain this correctly and the information helps you.
And thanks to Sam for the first example, it really managed to solve a problem
for us.
Post by Rob Mottram
Very sorry,
I have done this again on my system and it does not appear to be working
correctly. I am sure it did the first time. I will try again and let you know
if I manage to find a solution.
Post by Sam
Hi Rob/Chris,
First oppologies for the delay in getting back... was busy with other stuff
and did not check this post until today.
Chris you probably do not get the id set as, the code provided for to set
the new_id field with the object id if it is not a new form. this means that
you will need to click on save twice for the new_id to be populated...
Here is something you could use on the onload of the form
if(crmForm.FormType != 1)
{
if(crmForm.all.new_id.DataValue == null)
{
crmForm.all.new_id.DataValue = crmForm.ObjectId;
or set this directly to the url
crmForm.all.new_url.DataValue = 'http://servername:5555/leads/edit.aspx?id='
+ crmForm.ObjectId;
//Save the change
crmForm.Save();
}
The above code will store the url once the entity has been saved. This will
cause the form to refresh once again.
If you use this custom field to populate the url in the Create workflow...
you will get null values because when the entity is created this field is
not set. It is set after the entity has been saved and an id assigned to it.
So you could do with writing some kind of a wait condition to wait till this
id was populated. And with the code snippet provided above this will happen
immideately after the revord is saved and the form loads again...
Hope this helps!
Sam
_______________
Inogic
Innovative Logic
Innovative solutions for your SME ERP/CRM products
Web: www.inogic.com
--------------------------
Post by Rob Mottram
Hi I was just writing this when I noticed you had replied!
I have been trying to get this to work this morning, and have found out part
of the answer, and I can get the solution to work in CRM 3 but not in CRM 4.
If you create a URL field, and populate this with the full URL required for
the link. This field can then be added to the email in the workflow, and this
will make a link. The problem is that in CRM 4 there are not being made as
HTML links, just text so cannot be clicked on.
Here is a link to a page which explains the solution, which works perfectly
for CRM 3.
http://blogs.inetium.com/blogs/microsoftcrm/archive/2007/06/27/embedding-direct-links-to-crm-in-a-workflow-email.aspx
I am in contact with Microsoft support as to why URL Links don't appear to
be correct in CRM 4, once I have some more information I will let you know.
Post by Chris Brown
Hi Sam,
I was able to get the email link to work based upon your script and embeding
the link in the field on the entity. Outlook automatically creates a
hyperlink from the url string. The only problem I am running into now is
that when a task is created via workflow, I guess that workflow bypasses the
java script and does not get the link added to the task, so there is not link
to be sent.
Do you have any more suggestions?
Thanks again for all your help!
Post by Rob Mottram
I was expecting outlook to make it a link for me as well, but for some reason
it is not doing it on our system. This could be due to settings in outlook at
the moment the reason we need this has gone, but I think I am going to have
to get this working at somepoint.
I realised I might get the same issue as you at somepoint, which is that the
task does not have an ID until AFTER it has been saved. This means that the
ID field can only be populated the second time it is opened.
The other options I can think of would involve creating an assembly to
lookup the ID. This could either be run after create of the task and put the
ID into a field, or be called from the workflow to look up the ID each time
it is needed.
I have not yet had a chance to create any assemblies in CRM 4, but must look
at it soon, and expect this will be simple.
Post by Sam
Hi Chris,
I did anticipate this issue you might have and this is the explanation and
had put that in...
If you use this custom field to populate the url in the Create workflow...
you will get null values because when the entity is created this field is
not set. It is set after the entity has been saved and an id assigned to it.
So you could do with writing some kind of a wait condition to wait till this
id was populated. And with the code snippet provided above this will happen
immideately after the revord is saved and the form loads again...
So the change would have to made at the workflow level... put a wait
condition for entity condition and choose new_url contains data.. or is not
null... so ti will wait till the url field has been populated and this will
happen immideately upon reload... after the save.
HTH
Sam
_______________
Inogic
Innovative Logic
Innovative solutions for your SME ERP/CRM products
Web: www.inogic.com
--------------------------
Post by unknown
Hi;
I recently read this thread and see the problems with automatically adding the entity id when creating a case, opporunity, contact etc.
Here is code for a workflow plugin for getting the guid of an incident. It can easily be modified to use other entities. Once completed simply create a workflow and reference this custom workflow plugin from it. I wish I could say it was all my own work but I just changed the code a bit from Aamir Bashir?s CRM blog
-much thanks to him for doing most of the work.
using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Collections;
using System.Drawing;
using System.Workflow.ComponentModel.Compiler;
using System.Workflow.ComponentModel.Serialization;
using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Design;
using System.Workflow.Runtime;
using System.Workflow.Activities;
using System.Workflow.Activities.Rules;
using Microsoft.Crm.Sdk;
using Microsoft.Crm.SdkTypeProxy;
using Microsoft.Crm.Workflow;
using Microsoft.Crm.Workflow.Activities;
using Microsoft.Crm.Sdk.Query;
namespace EntityURL
{
[CrmWorkflowActivity("Add ID to Case URL field")]
public partial class Activity1 : SequenceActivity
{
protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
{
IContextService contextService = (IContextService)executionContext.GetService(typeof(IContextService));
IWorkflowContext context = contextService.Context;
ICrmService crmService = context.CreateCrmService();
WhoAmIRequest systemUserRequest = new WhoAmIRequest();
WhoAmIResponse systemUser = (WhoAmIResponse)crmService.Execute(systemUserRequest);
ColumnSet cols = new ColumnSet();
//Getting the ID of entity which unqiue itself
Guid guidID = new Guid(this.objectID.Value.ToString());
// i am using ?{? before GUID and "}" after.This field will hold the GUID of account
String Number = "{" + guidID + "}";
TargetRetrieveIncident target = new TargetRetrieveIncident();
target.EntityId = guidID;
RetrieveRequest getIncident = new RetrieveRequest();
getIncident.ReturnDynamicEntities = true;
getIncident.Target = target;
getIncident.ColumnSet = new AllColumns();
RetrieveResponse retrieved = (RetrieveResponse)crmService.Execute(getIncident);
DynamicEntity regardingIncident = (DynamicEntity)retrieved.BusinessEntity;
//I am using custom field to hold the value of ?GUID? .
if (regardingIncident.Properties.Contains("ba_entityurl"))
{
regardingIncident.Properties["ba_entityurl"] = Number;
}
else
{
regardingIncident.Properties.Add(new StringProperty("ba_entityurl", Number));
}
crmService.Update(regardingIncident);
return ActivityExecutionStatus.Closed;
}
public static DependencyProperty objectIDProperty = DependencyProperty.Register("objectID", typeof(Lookup), typeof(Activity1));
[CrmInput("objectID")]
[CrmReferenceTarget("incident")]
public Lookup objectID
{
get
{
return (Lookup)base.GetValue(objectIDProperty);
}
set
{
base.SetValue(objectIDProperty, value);
}
}
}
}
Submitted via EggHeadCafe
Twitter Search API with jQuery and JSONP
http://www.eggheadcafe.com/tutorials/aspnet/94d7bda5-c477-4ff9-b71d-e24e5fc70c24/twitter-search-api-with-jquery-and-jsonp.aspx
Loading...