web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Field changed only in Client side and not in server side(Database) CRM 2016

(0) ShareShare
ReportReport
Posted on by 108

Hi All,

I have difficulty in changing the field value in server side (i.e) database side. The field changed only in client side (i.e in the form - front end).

This is how it is working now: 

On the Task entity, when user clicked on the "Mark Complete" button, the Activity Status changed to "Completed" and "Actual End Date" gets populated to the date when user clicked on mark complete button. Once this action is done, form becomes read-only.

My requirement is, once the activity status is completed, change the custom field "processing status" to "Completed". I wrote a java script and changed the status. It changed only on the client side, but not updated on the database. 

Here is my Java scrip I wrote to chnage the processing status to "Completed".

function processingStatus()
{
var actualenddate = Xrm.Page.getAttribute("actualend").getValue();

if (actualenddate != null)
{
Xrm.Page.getAttribute("cf_processingstatus").setValue(979570001);
Xrm.Page.getAttribute(“cf_processingstatus”).setSubmitMode("always");
Xrm.Page.getControl("cf_processingstatus").setVisible(true);
}
}

Here is the screen shot of the form. 

Before User click "Mark Complete":

pastedimage1588463889686v1.png

After User clicked "Mark Complete"Button:

pastedimage1588463948229v3.png

I'm happy that the processing status changed to "Completed", but when I did an advanced find to see, I didn't get any results and then I realized it just updated only on the client side and not on the server side. I found this, as in the other form, it is still in pending status.

pastedimage1588463954066v4.png

Anyone help is much appreciated here. 

Many Thanks in advance,

I have the same question (0)
  • Suggested answer
    Marco.P Profile Picture
    2,405 on at

    Hi,

    I think the problem here is that you only set the value on form, but you do not save the new value.

    You can try to directly updating the field using web API:

    docs.microsoft.com/.../updaterecord

    Or you try with a workflow, something like this:

    pastedimage1588415663040v1.png

    Hope it helps,

    Marco


    If you've found the answer helpful, please mark it as Verified.

  • Poornimaa Profile Picture
    108 on at

    Hi Marco,

    Thanks for responsing my query. I tried using Web API as you sugested. Here is my coding for the same.

    I'm using CRM 2016 version 8.1. Is webApi available for this version? If not could you please suggest me an alternative.

    function processingStatus()

    {

       var actualenddate = Xrm.Page.getAttribute("actualend").getValue();

       var id = Xrm.Page.data.entity.getId();    

       if (actualenddate != null)

       {

           var data = { "cf_processingstatus" : "Completed"}

           // update the record

           Xrm.WebApi.updateRecord("Task", id, data).then(

               function success(result) {

                   console.log("Processing Status updated");

                   // perform operations on record update

               },

               function (error) {

                   console.log(error.message);

                   // handle error conditions

               }

           );

      }

    }

    and I'm getting the below error.

    TypeError: Cannot read property 'updateRecord' of undefined  

    at processingStatus.

    Could you please help me here?

    Many Thanks,

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 70 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 33 Most Valuable Professional

#3
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans