MS CRM 2011: How to add marketinglist members in dynamic marketing list using javascript? RRS feed

  • Question

  • Hi all,

    There is one dynamic marketing list record in marketinglist entity. I am adding marketing list members through customization query it is working. But I want to execute the query on onload of that record using Javascript. Basically at the time giving query it has placed into "query" field in marketinglist entity. Thats why I am downloading fetchXml and  updating that query into "query" field in Marketinglist using javascript. But on onload this functionality is not working. If any body knows please let me know how to do this. "Finally my requirement was how to add marketinglist members to dynamic marketing list using javascript."



    • Edited by sravan J Tuesday, October 2, 2012 9:44 AM
    Tuesday, October 2, 2012 9:32 AM

All replies

  • Hi,

    I'm not sure if I understand exactly what your requirement is. I think what you are trying to do is manipulate the query attribute of the marketing list, so that under circumstances, new members are automatically added to it. And you would like to do this in the "OnLoad" event of the marketing list entity.

    I guess the problem is that you are executing your JavaScript code to update the query in the "OnLoad" event, which may well succeed, but the changes you make are not mirrored directly in the opened marketing list. My guess is that the changes only take effect if you refresh the record in the browser. This is probably because your code is executed only after the record has been retrieved and displayed in the form.

    I don't think there is a way to do this via JavaScript (well, that's not true, you could refresh the record manually in your code after updating the query, but this is an ugly solution). But you can probably accomplish this by developing a plugin that hooks on the "Retrieve" message of the marketing list entity and edits the query attribute before retrieving and displaying the record.

    Hope I could identify your problem.



    Please mark this reply as answer if it helps you find a resolution to your problem.

    Sunday, October 7, 2012 4:30 PM