Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM forum
Unanswered

Quick Create: Appointment (Xrm.Navigation.openForm)

Posted on by
I can open the Quick Create: Appointment not problem and I can pre-populate some fields with no problem. I am have trouble populating the regardingobjectid field. I have step thru the JavaScript and I can see the information needed to populate that field but it keeps displaying "No Name" in the lookup field.
 
This is a simplified version of the JavaScript
 
function appointmentQC() {  
    debugger;
    try {
        var entityFormOptions = {};
        entityFormOptions["entityName"] = "appointment";
        entityFormOptions["useQuickCreateForm"] = true;  
        var formParameters = {};
        formParameters["subject"] = Xrm.Page.data.entity.attributes.get("subject").getValue();
        formParameters["regardingobjectid"] = Xrm.Page.data.entity.attributes.get("regardingobjectid").getValue()[0].id;
        formParameters["regardingobjectname"] = Xrm.Page.data.entity.attributes.get("regardingobjectid").getValue()[0].name;
        formParameters["regardingobjecttype"] = Xrm.Page.data.entity.attributes.get("regardingobjectid").getValue()[0].entityType;  
    // Open the form.
        Xrm.Navigation.openForm(entityFormOptions, formParameters).then(
            function (success) {
               //alert(success);
            },
            function (error) {
                //alert(error);
            });
    }
    catch (err) {
        alert(err.message);
    }    
}
  • Suggested answer
    Sachin Jadhav Profile Picture
    Sachin Jadhav 127 on at
    Quick Create: Appointment (Xrm.Navigation.openForm)
    I think you ca build the whole regarding object value upfront and send it in the form parameters like follows.
     
    recId = <record id to be set in regarding>;
    recEntityName = <schema name of the entity for above recId>;
    recName = <Name of the entity for above recId>;
     
    var regardingValue = new Array();
    regardingValue[0] = new Object();
    regardingValue[0].id = recId;
    regardingValue[0].name = recName;
    regardingValue[0].entityType = recEntityName;
     
    var formParameters = {};
    formParameters["regardingobjectid"] = regardingValue;

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,532 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,501 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans