crmForm.que? Lookup This post is aimed at people who are just beginning to make javascripts codes for forms and fields of CRM. At least when I started in this world the first thing to do was just sent me this and often unaware of the properties and methods that would enable faster my work ... in order. So that does not happen as I do, I'll leave a list of properties and methods:
Global Variables
cadent
gives us a text using the server name
USER_LANGUAGE_CODE |
language code provides the user selected | ORG_LANGUAGE_CODE |
Provides code language pack dela organization | ORG_UNIQUE_NAME |
Provides the name of the organization | |
Properties | crmForm |
crmForm.all
allows us to access all the form fields
crmForm.IsDirty |
returns a boolean. True if the field has been modified | crmForm.FormType |
Gets an integer depending on how you fall on the form. As valid values \u200b\u200bare: Undefined | -Form Type = 0 | -Create Form = 1
-Update Form = 2 | -Read Only Form = 3 -Disabled Form = 4 -Quick Create Form = 5 -Bulk Edit Form = 6 crmForm.ObjectId Returns a string that displays the GUID of the record open. If the form is of type "Create Form" the vaslor be null. | crmForm.ObjectTypeCode
Gets the code of the open form entity. | crmForm.ObjectTypeName |
Gets the name of the entity of the open form. | |
Multientity - (as the client) Customizing
Sometimes we need a lookup which allows us to handle both accounts and contacts (similar to that in the form of cases) or lookups as "Concerning." While it's own CRM functionality in this ejempplo (which is based on this post
| ) we will emulate a multi-entity lookup which allows us to make the registration of a contact or account. Suppose you have a custom entity called: jl_entidad. Must build relationships with account and contact the institution where they are the principals. Add fields jl_accountid lookup and type in the form jl_contactid jl_entidad. | OnLoad event Now, copy the following code: var
accountLookup = crmForm.all.jl_accountid;
contactLookup var = crmForm.all.jl_contactid; accountLookup.lookuptypeIcons =" \u200b\u200b/ _imgs/ico_16_1.gif: / _imgs/ico_16_2.gif "
if (contactLookup.DataValue! = null) { accountLookup.DefaultValue = contactLookup.DataValue;
accountLookup.DataValue = contactLookup.DataValue;
if (typeof (accountLookup.DataValue [0]. data)! = "undefined") {
accountLookup.DefaultValue [0]. accountLookup.DataValue data = [0]. data;
}}
OnSave In the event copy the following: var
accountLookup = crmForm.all.jl_accountid;
contactLookup var = crmForm.all . jl_contactid;
if (accountLookup.DataValue == null) {
contactLookup.DataValue = null;
} else {var customer = accountLookup.DataValue
[0];
if (customer.type == "1") {
contactLookup.DataValue = null;
} else {
contactLookup.DataValue = accountLookup.DataValue;
accountLookup.DataValue = null;
}}