Wednesday, 7 December 2016

Field Service - Agreement - Deep Dive

Field service agreement is utilised to automatically generate work orders and invoices.

 
















The schema and logical name are msdyn_customerasset.

The fields are: -


Agreement (uniqueidentifier) msdyn_agreementid
Agreement Number (string)   msdyn_name
Service Account (lookup)  msdyn_serviceaccount
Billing Account  (lookup)  msdyn_billingaccount
System Status (picklist) msdyn_systemstatus
Sub-Status (lookup) msdyn_substatus
Description (string) msdyn_description
    
Start Date (DateTime) msdyn_startdate
End Date (DateTime) msdyn_enddate
Duration (integer) msdyn_duration
Agreement Details (memo) msdyn_agreementdetails

Originating Agreement (lookup)   msdyn_originatingagreement               
Price List (lookup) msdyn_pricelist
Service Territory (lookup) msdyn_serviceterritory
Taxable (boolean) msdyn_taxable
Sales Tax Code (lookup) msdyn_SalesTaxCode *

Child Index (integer) msdyn_childindex *
Date Canceled (DateTime) msdyn_datecanceled *

                
This is a custom entity, so to understand fields please see some notes below: -


Agreement Number - is automatically generated. It can be configured in the setting for field service.
Service Account - is the service account that bookings will generated against.
Billing Account  - is the account against which the invoices will be generated.
System Status - should not be customised, instead use the sub-status to perform customisations.
Sub-Status - as above

Start Date - start of the agreement
End Date - end of agreement
Duration - calculates the difference between start and end dates.
Agreement Details - a textbox to add details and notes.

Originating Agreement - used to link to originating agreement .             
Price List - self explanatory
Service Territory - self explanatory
Taxable - yes or no
Sales Tax Code - applicable tax code
       
---------------------------------------------------------------------------------------------------------
Example accessing fields using late binding.
--------------------------------------------------------------------------------------------------------
var msdyn_agreementdetails = result["msdyn_agreementdetails"];
var msdyn_agreementid = result["msdyn_agreementid"];
var _msdyn_billingaccount_value = result["_msdyn_billingaccount_value"];
var _msdyn_billingaccount_value_formatted =                result["_msdyn_billingaccount_value@OData.Community.Display.V1.FormattedValue"];

var _msdyn_billingaccount_value_lookuplogicalname = result["_msdyn_billingaccount_value@Microsoft.Dynamics.CRM.lookuplogicalname"];

var msdyn_childindex = result["msdyn_childindex"];
var msdyn_childindex_formatted = result["msdyn_childindex@OData.Community.Display.V1.FormattedValue"];

var msdyn_datecanceled = result["msdyn_datecanceled"];
 ar msdyn_description = result["msdyn_description"];
var msdyn_duration = result["msdyn_duration"];
var msdyn_duration_formatted = result["msdyn_duration@OData.Community.Display.V1.FormattedValue"];

 var msdyn_enddate = result["msdyn_enddate"];
 var msdyn_name = result["msdyn_name"];
 var _msdyn_originatingagreement_value = result["_msdyn_originatingagreement_value"];
  var _msdyn_originatingagreement_value_formatted = result["_msdyn_originatingagreement_value@OData.Community.Display.V1.FormattedValue"];
           
var _msdyn_originatingagreement_value_lookuplogicalname = result["_msdyn_originatingagreement_value@Microsoft.Dynamics.CRM.lookuplogicalname"];
         
var _msdyn_pricelist_value = result["_msdyn_pricelist_value"];
         
 var _msdyn_pricelist_value_formatted = result["_msdyn_pricelist_value@OData.Community.Display.V1.FormattedValue"];
           
var _msdyn_pricelist_value_lookuplogicalname = result["_msdyn_pricelist_value@Microsoft.Dynamics.CRM.lookuplogicalname"];
           
var _msdyn_salestaxcode_value = result["_msdyn_salestaxcode_value"];
 var _msdyn_salestaxcode_value_formatted = result["_msdyn_salestaxcode_value@OData.Community.Display.V1.FormattedValue"];
           
var _msdyn_salestaxcode_value_lookuplogicalname = result["_msdyn_salestaxcode_value@Microsoft.Dynamics.CRM.lookuplogicalname"];
           
var _msdyn_serviceaccount_value = result["_msdyn_serviceaccount_value"];
var _msdyn_serviceaccount_value_formatted = result["_msdyn_serviceaccount_value@OData.Community.Display.V1.FormattedValue"];
           
var _msdyn_serviceaccount_value_lookuplogicalname = result["_msdyn_serviceaccount_value@Microsoft.Dynamics.CRM.lookuplogicalname"];
           
var _msdyn_serviceterritory_value = result["_msdyn_serviceterritory_value"];
           
var _msdyn_serviceterritory_value_formatted = result["_msdyn_serviceterritory_value@OData.Community.Display.V1.FormattedValue"];
            var _msdyn_serviceterritory_value_lookuplogicalname = result["_msdyn_serviceterritory_value@Microsoft.Dynamics.CRM.lookuplogicalname"];
           
var msdyn_startdate = result["msdyn_startdate"];
 var _msdyn_substatus_value = result["_msdyn_substatus_value"];
var _msdyn_substatus_value_formatted = result["_msdyn_substatus_value@OData.Community.Display.V1.FormattedValue"];
           
var _msdyn_substatus_value_lookuplogicalname = result["_msdyn_substatus_value@Microsoft.Dynamics.CRM.lookuplogicalname"];
         
 var msdyn_systemstatus = result["msdyn_systemstatus"];
 var msdyn_systemstatus_formatted = result["msdyn_systemstatus@OData.Community.Display.V1.FormattedValue"];
           
var msdyn_taxable = result["msdyn_taxable"];
  var msdyn_taxable_formatted = result["msdyn_taxable@OData.Community.Display.V1.FormattedValue"];


-------------------------------------------------------------------------------------------------------------------
Example using early binding
-------------------------------------------------------------------------------------------------------------------
var msdyn_AgreementDetails = result.msdyn_AgreementDetails;
    var msdyn_agreementId = result.msdyn_agreementId;
    var msdyn_BillingAccount = result.msdyn_BillingAccount;
    var msdyn_ChildIndex = result.msdyn_ChildIndex;
    var msdyn_DateCanceled = result.msdyn_DateCanceled;
    var msdyn_Description = result.msdyn_Description;
    var msdyn_Duration = result.msdyn_Duration;
    var msdyn_EndDate = result.msdyn_EndDate;
    var msdyn_name = result.msdyn_name;
    var msdyn_OriginatingAgreement = result.msdyn_OriginatingAgreement;
    var msdyn_PriceList = result.msdyn_PriceList;
    var msdyn_SalesTaxCode = result.msdyn_SalesTaxCode;
    var msdyn_ServiceAccount = result.msdyn_ServiceAccount;
    var msdyn_ServiceTerritory = result.msdyn_ServiceTerritory;
    var msdyn_StartDate = result.msdyn_StartDate;
    var msdyn_SubStatus = result.msdyn_SubStatus;
    var msdyn_SystemStatus = result.msdyn_SystemStatus;
    var msdyn_Taxable = result.msdyn_Taxable;

------------------------------------------------------------------------------------------------















No comments:

Post a Comment