Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Open Custom Activity From Account on Button Click

Posted on by 140

Hi,

I have a requirement to Open Custom Activity form from Account on clicking of a button from Ribbon. I have used below script to open the custom activity in new window. But , I wanted to auto fill the Regarding field. How can i pass the parameter for Regarding field to auto filled.

var windowOptions = {
openInNewWindow: true
};
Xrm.Utility.openEntityForm("My Custom Activity", null, windowOptions);

*This post is locked for comments

  • Verified answer
    Kokulan Profile Picture
    Kokulan 18,048 on at
    RE: Open Custom Activity From Account on Button Click

    Could you please use the new navigation library as shown below?

    var entityFormOptions = {};
    entityFormOptions["entityName"] = "yourcustomactivitylogicalname not displayname";
    entityFormOptions["openInNewWindow"] = true;

    // Open the form.
    Xrm.Navigation.openForm(entityFormOptions, formParameters).then(
    function (success) {
    console.log(success);
    },
    function (error) {
    console.log(error);
    });

  • Suggested answer
    GPrasanna Profile Picture
    GPrasanna 140 on at
    RE: Open Custom Activity From Account on Button Click

    I got this worked by passing the paramaters. Hope it might help someone .

       Xrm.Utility.openEntityForm('My Custom Activity', null, { pId: Xrm.Page.data.entity.getId().replace(/{|}/g, ''), pType: Xrm.Page.data.entity.getEntityName(), pName: Xrm.Page.getAttribute('name').getValue() }, windowOptions);

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,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans