Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Lookup record's field in Appointment

Posted on by Microsoft Employee

Hi,

I am not a programmer but with the help of few blogs, I am trying this. I am concatenating few fields of appointment entity to form topic (i.e.) "Account's owner/first 5 characters of Account Name/Appointment location/Appointment type (which is an option field)".

"Regarding" field is already restricted to be account only. I am able to get everything done apart from regardingobjectid's owner into this concatenation. This is what I have so far:

function concatappointmentsubject()
{
var SubName = Xrm.Page.getAttribute("new_subname").getValue();
var City = Xrm.Page.getAttribute("location").getValue();
var Type = Xrm.Page.data.entity.attributes.get("new_type");
var Typetext = Type.getText();
var Compnamelookup = Xrm.Page.getAttribute("regardingobjectid");
var CompnamelookupTextvalue;
if (Compnamelookup != null)
   {
        var CompnamelookupValue = Compnamelookup.getValue();
        if ((CompnamelookupValue != null))
         {
             CompnamelookupTextvalue = CompnamelookupValue[0].name;
             var Compnamelookupid = CompnamelookupValue[0].id;
             var Compa = CompnamelookupTextvalue.substring(0, 5);
        }
  }
Xrm.Page.getAttribute("new_subname").setValue(Compa + "/" + City + "/" + Typetext);
Xrm.Page.getAttribute("new_subname").setSubmitMode("always");
}

Could someone help me to include appointment's account's owner in this concatenation?

Thanks for the help!

*This post is locked for comments

  • ashlega Profile Picture
    ashlega 34,475 on at
    RE: Lookup record's field in Appointment

    Try this maybe:

    function concatappointmentsubject()
    {
    var SubName = Xrm.Page.getAttribute("new_subname").getValue();
    var City = Xrm.Page.getAttribute("location").getValue();
    var Type = Xrm.Page.data.entity.attributes.get("new_type");
    var Typetext = Type.getText();
    var Compnamelookup = Xrm.Page.getAttribute("regardingobjectid");
    var CompnamelookupTextvalue;

    var Compa = "";
    if (Compnamelookup != null) 
       {
            var CompnamelookupValue = Compnamelookup.getValue();
            if ((CompnamelookupValue != null))
             {
                 CompnamelookupTextvalue = CompnamelookupValue[0].name;
                 var Compnamelookupid = CompnamelookupValue[0].id;
                 Compa = CompnamelookupTextvalue.substring(0, 5);
            }
      }
    Xrm.Page.getAttribute("new_subname").setValue(Compa + "/" + City + "/" + Typetext);
    Xrm.Page.getAttribute("new_subname").setSubmitMode("always");
    }

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans