USD – Create phone call (NEW_CRM_Page)

I was recently asked a question regarding Unified Service Desk for Microsoft Dynamics CRM, the question was about how to correctly set the “To” field on a phone call. (Keeping in mind that the “To” field is an activity party field.)

As always, I do try to create blog posts when asked questions, assuming others may have the same question.

In this example I will show how to create a phonecall for a contact but you could adapt this to add a phone call to an account, case etc. You can see below I have already opened a contact session and that in my agent script I have created an answer “Create Phonecall”. I am going to assume you already know how to do these things but if not please refer to the other posts on my blog. Microsoft also provide a very useful web site you might want to look at! J

Having created your agent script you will need to create an action that will be linked to the script.

Tip: You could also use this same approach if calling the action from toolbar. Or if you always wanted a phonecall you could add the action to the BrowserDocumentComplete events on the contact.

My action is below;

Tip: Notice that the help mentions the window navigation rule. I have found this to be a significant comment, so more on that in a second.

The hosted control is “phonecall”, this is simply the CRM Page I have used to hold my phonecall. The action is “NEW_CRM_Page”. Then the most important section is the data portion, in which you will need to link the phone call to the contact. This will involve setting the phone call to be regarding the contact and to set the “To” (activity party) to also be the contact.

LogicalName=phonecall
regardingobjectid=[[contact.Id]]
regardingobjectidname=[[contact.fullname]]
regardingobjecttypecode=contact
partyid=[[contact.Id]+]
partyname=[[contact.fullname]+]
partytype=[[contact.etc]]

Now let’s look at the window navigation rule I mentioned. If when you test your configurations, you find the phonecall tab displays but it is blank your problem will almost certainly be related to Window Navigation Rules. I have found them to be very “particular” when it comes to the NEW_CRM_Page action! If you suffer this type of problem look in the debugger to see which navigation rule is being triggered. Typically if you get a blank screen you will find a rule isn’t being triggered and you need to create one.

The rule I created looked like this;

  • My order is 5003, simply because I want other rules on phonecalls to be evaluated first. (Any number will do really!)
  • My from is “Phonecall”, You might have expected the from to have been “Contact”! Trust me, in this circumstance you want “Phonecall”.
  • The entity is as expected, pheoncall.
  • Route type is Popup as this rule kicks in when a new phonecall “pops up”. The action you want is “Route Window”.
  • The destintation is Tab, then the target tab and show trab are the same thing “Phonecall”.
  • I have opted to hide the navigation bar, this is an optional configuration.

One final tip: An issue can be that you can’t add a phone call to a new contact until the contact has been saved. To help prevent this happening you might want to add a condition to your agent script answer. Something like “[[contact.Id]]”!=”” should do the trick!

Hopefully this post has been useful. J

18 thoughts on “USD – Create phone call (NEW_CRM_Page)

  1. Hi sir, I am trying to open a phone call activity through the toolbar button on contact search page, but when I clicked on the phone call activity button, it’s completely blank. when I checked it in Debugger, there is no error found. I had even created the window navigation as you created above.

    Note: I had created the phone call activity hosted control & make it non-global, hence it will be session specific.

    Any comment ?

    Like

    • Can you see the window navigation rule in the debugger? Every time I have had a problem like you describe it has related back to the window navigation rule. (Unfortunately, in my experience, They can be a bit of a pain to debug and fix!!)

      Like

  2. when I open the Debugger, I didn’t find the details of window navigation rule, I had created before, I can see that action call had executed all the replacement parameters correctly. Now, what to do, Any way-out ? Do I need to create another window navigation rule ?

    Like

    • There will be something wrong with your navigation rule. So double check everything with that. And maybe experiment with changing “Popup” to “In Place” etc. Also look at the order of the navigation rule it could be that another rule is being evaluated first.

      Like

  3. Hello Neil,

    I think that I found an error. Have you ever tried to add other parameters? I tried:

    phonenumber=1234567890
    subject=Test
    regardingobjectid=[[contact.Id]]
    regardingobjectidname=[[contact.fullname]]
    regardingobjecttypecode=contact
    partyid=[[contact.Id]+]
    partyname=[[contact.fullname]+]
    partytype=[[contact.etc]]

    This didn’t work for me…

    But if I removed all “lookups fields” works fine!

    phonenumber=1234567890
    subject=Test

    Do you know some trick? lol

    Regards,
    Tiago

    Like

    • Yes and no! I think you have seen a limitation of the product.

      On the New_CRM_page you will see the following note …

      The rest of the parameters should consist of name=value pairs, which will prepopulate the values in the CRM form for the new entity record

      I think this is hinting that it is different to the CreateEntity action which can set any value. You could use “NEW_CRM_Page”, then have actions that use a RunXrmCommand to inject values into the form. You’ll need to play around to ensure that the page has loaded fully before you run the RunXrmCommand action.

      I agree life (and USD) would be much simpler if the NEW_CRM_Page action let you set any value on the page.

      Like

      • Absolute right!

        After put the RunXrmCommand in BrowserDocumentCompleted of mine hosted control it worked fine!

        Now, I have to know how to work in the best way with USD, because it really doesn’t make sense in this case… 😦

        Thank you for your time!

        Best Regards,
        Tiago Cardoso

        Like

  4. Hi,

    I’m having the same problem as @Tiago and i’m trying to use RunXrmCommand but without any luck so far.

    Have you any exemple on how to work with lookup field in RunXrmCommand?

    Thanks!!

    Like

  5. Your RunXrmCommand would need to include a data portion something list this ….

    function RunXrmCommand() {

    // ** FOR A LOOK UP
    var value = new Array();
    value[0] = new Object();
    value[0].id = <> ;
    value[0].name = <<>>;
    value[0].entityType = <<>>;
    Xrm.Page.getAttribute(“<>”).setValue(value);

    // *** FOR A TEXT FIELD
    Xrm.Page.getAttribute(“<>”).setValue(<>);

    }
    RunXrmCommand();

    You can add replacement parameters as required. For example ….

    Xrm.Page.getAttribute(“subject”).setValue(“[[contact.fullname]+] Called.”)

    This approach would be for a standard lookup field. If you are setting an activity party field you’d need something BASED on this ….

    function setToPartyList(fieldName, id, name, entityType) {
    var party = Xrm.Page.getAttribute(fieldName);

    // Create new array
    var partlist = new Array();
    partlist[0] = new Object();

    partlist[0].id = id;
    partlist[0].name = name;
    partlist[0].entityType = entityType;

    // Set array value
    party.setValue(partlist);

    };

    Like

    • Thanks for the fast reply, but i tried those two exemples already :

      First exemple:

      function RunXrmCommand_Example() {
      Xrm.Page.getAttribute(“to”).setValue(“test5”);
      var party = Xrm.Page.getAttribute(“to”);
      // Create new array
      var partlist = new Array();
      partlist[0] = new Object();
      partlist[0].id = [[contact.Id]v];
      partlist[0].name = [[contact.fullname]+];
      partlist[0].entityType = [[contact.LogicalName]];

      // Set array value
      party.setValue(partlist);
      }
      RunXrmCommand_Example();

      Second exemple:

      function RunXrmCommand_Example() {
      var value = new Array();
      value[0] = new Object();
      value[0].id = [[contact.Id]v];
      value[0].name = [[contact.fullname]v];
      value[0].entityType = ‘contact’;
      Xrm.Page.getAttribute(“from”).setValue(value);
      }
      RunXrmCommand_Example();

      Sadly for me, they didn’t work.

      I also tried to so the same to a string fiield only like this way and it worked just fine :

      function RunXrmCommand_Example() {

      Xrm.Page.getAttribute(“subject”).setValue(“test”);

      }
      RunXrmCommand_Example();

      is there something that i doing wrong?

      Like

      • Maybe not …. one problem could be your version of USD. Make sure you are using the latest one. (Released a couple of days ago.)

        Also you might be suffering with a timing problem that the RunXrmCommand is trying to inject details into the form before it has finished loading. You can get round this but ….. I have another option!!!!!

        An alternative approach is available to create a phonecall record and open that in a tab. (Allowing me to set subject and other fields which isn’t possible with the Open_CRM_Page approach.) There is also a potential timing concern with this approach as I can’t open the record until it is created. But I can solve that!

        I have tested this in my CRM solution and have started a blog post to document how I achieved this.

        I will hopefully finish the post this evening and publish soon.

        Like

  6. As a plus information, i tried to test them with the Debugger, while a new phone call has been created in the same session of course, and i still have the same problem.
    Anyway, i will be waiting for your blog post to see if i’m doing something wrong.

    Thanks for yours fas replies!!

    Like

  7. Pingback: USD – The Book | Microsoft Dynamics CRM and Unified Service Desk

  8. Hello

    We are trying to make the same but with a service appointment. We have created an action call NEW_CRM_PAGE with the following parameters:

    LogicalName=serviceappointment
    partyid=[[contact.Id]+]
    partyname=[[contact.fullname]+]
    partytype=11
    regardingobjectid=[[contact.Id]+]
    regardingobjectidname=[[contact.fullname]+]
    regardingobjecttypecode=contact
    subject=Service Appointment

    The action call is invoked in agent script. It opens the Service appointment and pre-populates the Regarding field (with the contact) and the subject (with “Service Appointment”), but the customers field where we need to populate with the contact is empty.

    Also we have tested with the CreateEntity (https://neilparkhurst.com/2016/04/19/usd-create-phone-call-saved/) but it generates an error in the Action Call Create Entity for the serviceappointment because it says that the scheduled start could not be null. But our idea is that the CRM user select the schedule time.

    is there anything that we are not having in account?

    Thanks

    Like

  9. Thanks for your comment. I haven’t actually tried to use service appointment like this! Let me know if these suggestions work. If not I will try for you.

    1. You cannot set the subject in the New_CRM_Page action. You’ll need to use a CreateEntity action and then open the record if that is essential. Although you will then hit your other problem that the scheduledstart cannot be null.
    2. Try replacing “partytype=11” with “partytype=[[contact.etc]]”

    Let me know how you get on.

    Neil

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s