Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Work flow not populating the created records in subgrid.

Posted on by Microsoft Employee

Hi,

I have created one system workflow on Event Campaign and creating 2 records in custom entity.
I do have a subgrid on the Event campaign to show the newly created records.

Work flow triggering fine and creating the records but created records are not visible on the subgrid.
Can someone please assist me on this that would be highly appreciated.

 

Thanks,

*This post is locked for comments

  • Suggested answer
    Andreas Cieslik Profile Picture
    Andreas Cieslik 9,265 on at
    RE: Work flow not populating the created records in subgrid.

    Hi Rahul,

    In general the code looks like this:

    public static void AssociateRecords(EntityReference A, EntityReference B)

    {

               // Creating EntityReferenceCollection

               EntityReferenceCollection relatedEntities = new EntityReferenceCollection();

               // Add the related entity

               relatedEntities.Add(A);

               // Add the relationship schema name

               Relationship relationship = new Relationship("new_relationshipname");

               // Associate the A record to B

               _Service.Associate(B.LogicalName, B.Id, relationship, relatedEntities);

    }

    Maybe this workflow can help you also:

    crm2011distributewf.codeplex.com

    Cheers,

    Andreas

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Work flow not populating the created records in subgrid.

    Hi Nick,

    Thanks for the reply.

    Above code is not working when I was trying to convert my workflow as Real time and tried to implement Jscript.

    but I couldn't get succeeded.

    I'm planing to associate custom entity records with Event Campaign by writing the custom workflow.

    Do have any idea how to implement the logic inside workflow? that would be highly appreciated.

    Thanks,

  • Nick Plourde Profile Picture
    Nick Plourde on at
    RE: Work flow not populating the created records in subgrid.

    A grid won't automatically refresh itself. It needs a legitimate event to happen. Something like a load, a save or creating a record while using the '+' button on it. Same thing applies to plugins.

    But it's possible configure it. In my case, I had to do it on the refresh of another grid.

    First, make sure your workflow is sync.

    Second, in javascript, create a function like this:

    function onRefreshMyOtherGrid() {

          Xrm.Page.getControl('myGridName').refresh();

    }

    Third, you need to find an event that occurs at the same time. In this case when the first grid is refreshed. Then add this on the load of the form.

    function onLoad() {

        Xrm.Page.getControl('MyOtherGrid').addOnLoad(onRefreshMyOtherGrid);

    }

    So, when I added a record in a grid. The grid to the right got refreshed too.

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,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans