0

I have a Javascript code registered onSave of record. I need to check whether the save operation is happening by clicking on Save button or saving programmatically like Xrm.Page.data.entity.save().

Do we have a JScript code to get the source control of the event, means event generator?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Charan Raju C R
  • 758
  • 5
  • 21
  • 43

2 Answers2

1

Without this information on the context why not set a variable in the JavaScript function where you call entity.save explicitly? You can then check this from any other JavaScript function to determine "context". It's a bit of a hacky global flag but it'll do the job.

If you need to get a hold of this "context" within a plugin you can create a hidden attribute on the form setting submitMode('always') that you set prior to save within the custom JavaScript and reset on load.

Darren Lewis
  • 8,338
  • 3
  • 35
  • 55
0

Have you tried something like that: https://community.dynamics.com/product/crm/f/117/t/58773.aspx

Greg Oks
  • 2,700
  • 4
  • 35
  • 41
  • This link is to prevent the form saving. I need to check the event generator. Wanted to know whether saving the form by clicking on Save button or programmatically. And I tried executionContext and no luck. – Charan Raju C R Nov 16 '12 at 08:21