Page 2 of 2

Re: Service Manager Job - Obtain Task details of a task  Topic is solved

PostPosted: Mon Aug 25, 2014 10:51 pm
by Mike.Sheen
indikad wrote:code attached. Thanks.


Ok - the plugin you supplied hooks into the SaveEnding event of the job, and sets a custom field value and then calls the job save method. I said previously not to call the custom field save method, but instead use the job save method - but what I didn't realise was that you were doing this in a SaveEnding handler.

You should instead be setting your custom field values in the SaveStart event. Add a handler to that instead, and then set your custom field contents there - and don't call the save method at all - that will happen for you.

To understand the sequence of events:

  • User clicks the Save toolbar ribbon
  • Form controller invokes the form Save method
  • Form invokes the business logic save method
  • Business logic starts a new SQL transaction if one is not already started
  • Business logic raises a SaveStart event
  • Business logic issues insert/update/delete to SQL
  • Business logic raises a SaveEnding event
  • Business logic commits or rollbacks transaction (if it started the transaction)
  • Business logic raises a SaveEnd event

In the above flow, your plugin added a handler for the business logic SaveEnding event - so your plugin gets invoked after the updates have taken place. You need to modify your custom field contents before the SQL is issued, so that would be at the SaveStart.

Attached is a modified version of your plugin which works for me. Note that in your code you were checking for the custom field name = "Test Field", but the actual custom field name is "Test field" - string comparisons are case sensitive, so I modified your code to have the correct casing.

Re: Service Manager Job - Obtain Task details of a task

PostPosted: Tue Aug 26, 2014 11:18 am
by indikad
Hi Mike - its the main tab addresses I need. Not the Billing - ( I need to grab that address and send off in a message ) - The customer types in different addresses and Billing is not the same as the main tab address always - in their case.

Re: Service Manager Job - Obtain Task details of a task

PostPosted: Tue Aug 26, 2014 11:24 am
by Mike.Sheen
indikad wrote:Hi Mike - its the main tab addresses I need. Not the Billing - ( I need to grab that address and send off in a message ) - The customer types in different addresses and Billing is not the same as the main tab address always - in their case.


Use the DeliveryAddress property then.

Re: Service Manager Job - Obtain Task details of a task

PostPosted: Tue Aug 26, 2014 4:36 pm
by indikad
Mike.Sheen wrote:
indikad wrote:Hi Mike - its the main tab addresses I need. Not the Billing - ( I need to grab that address and send off in a message ) - The customer types in different addresses and Billing is not the same as the main tab address always - in their case.


Use the DeliveryAddress property then.


ah yes - apologies for my ignorance!


will test the saving code soon.