Solved

Change the Status and save entity from the Form

Posted on 2012-03-15
3
473 Views
Last Modified: 2012-04-11
I need to change the status of an entity and save it on click of a custom ribbon button.
If I change the status using the StatusRequest and response I first need to have the record saved. As soon as I do a Xrm.Pages.Data.entity.save the form reloads and I cannot call the state request response functions.

How does the standard CRM do it in on the mark complete ?

Any way this can be accomplised ?
0
Comment
Question by:Mayank_Bhardwaj
  • 2
3 Comments
 
LVL 27

Accepted Solution

by:
Chinmay Patel earned 500 total points
ID: 37728606
Hi Mayank_Bhardwaj,

CRM has different masages to accomplish such tasks.
Try lookin into SetState message. Basically you will write JavaScript to fire a SetState method and then use Save. Remember if you are disabling the record then Save will not work after SetState.

Otherthat that you could do it this way
Keep a hidden field on the form say StateChange. While OnSave Set It To : true. OnLoad : Check if it is true or not, if yes then fire the SetState command or do whatever else you need to do. Also dont forget to change StateChange to false or relevant value after you have fired SetState request.

Regards,
Chinmay.
0
 

Author Comment

by:Mayank_Bhardwaj
ID: 37728734
Hi Chimay,
This is Mayank, your trainees Yamaha :-). Well the problem with SetState message is that the record should already be saved, cos it needs a guid of the entity as a parameter.
What I am trying to accomplish here is as follows
I have this SMS Entity. I have created a Ribbon Button called Send. On a new SMS form the user fills up all the details and when the user clicks on the send button, the sms entity should be saved with the state = Scheduled and Status Reason as Scheduled too.
0
 
LVL 27

Expert Comment

by:Chinmay Patel
ID: 37728774
Hi Mayank,

Of course I don't forget easy. :)

Now consider the second workaround I have mentioned. If you are not comfortable with that approach, you can always go with a Plugin.

Let me know if you see any challenges here.

Regards,
Chinmay.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question