Difference between revisions of "New"

From Accelerator
Line 140: Line 140:
The New UI will fetch all existing workflows based on the following example SQL
The New UI will fetch all existing workflows based on the following example SQL


EG
   select Work_Description, Work_WorkflowId  
   select Work_Description, Work_WorkflowId  
from workflow  
  from workflow  
where Work_Enabled='Y' and Work_WorkflowId in (select distinct WkRl_WorkflowId  
  where Work_Enabled='Y' and Work_WorkflowId in (select distinct WkRl_WorkflowId  
from WorkflowRules  
  from WorkflowRules  
where WkRl_RuleType='Pre' and WkRl_Enabled='Y'  
  where WkRl_RuleType='Pre' and WkRl_Enabled='Y'  
and WkRl_Entity='opportunity')  
  and WkRl_Entity='opportunity')  


This gives the workflows that we then fetch the entry "state" for
This gives the workflows that we then fetch the entry "state" for
 
EG
   select WkSt_Name  
   select WkSt_Name  
   from WorkflowState  
   from WorkflowState  

Revision as of 13:17, 27 January 2022

The NEW menu is available on all menu bars in the task pane.

New1.jpg

Clicking on an item loads a modal with the fields on it. The context with which something is created is important as this will preset some fields.

New2.jpg

Click Save to Save the record and then the UI will show the summary of this record.


Deduplication is available on the company

New3.jpg

and person screens

New4.jpg


Field Mappings

This is the current field mappings from the email to the NEW screen fields. Setting default values for these fields in Create Scripts will have no effect.

  • Company
 comp_name=Name parsed from email address
 comp_website=domain parsed from email address
 Business Email field is set to the from address
  • Person
 pers_firstname=fullName (first part)
 pers_lastname=fullName (all bar first part)
 pers_website=domain parsed from email address
 Business Email field is set to the from address
  • Opportunity
 oppo_description=subject
 oppo_note=body
 oppo_primarycompanyid=set to the context under which the opportunity was created
 oppo_primarypersonid=set to the context under which the opportunity was created
  • Case
 case_description=subject
 case_problemnote=body
 case_primarycompanyid=set to the context under which the opportunity was created
 case_primarypersonid=set to the context under which the opportunity was created
  • Lead
 lead_companyname=Name parsed from email address
 lead_companywebsite=domain parsed from email address
 lead_personfirstname=fullName (first part)
 lead_personlastname=fullName (all bar first part)
 lead_description=subject
 lead_details=body
 lead_personemail=from email address

Customising

A. The screen fields are controlled by metadata.

The screens are called "ENTITYOfficeIntNew".


B. To add in a primary custom Entity*

   created using the entity wizard

Open the "...custompages/sagecrmws/web.config"

Edit the line "NewEntities"

EG..here we add in "Project"

   <add key="NewEntities" value="Company,Person,Lead,Cases,Opportunity,Project" />

C. Screen Scripting

Supported

   CustomContent - Basic HTML but no client script will be included. 
   CreateScript items - Caption, Required,DefaultValue,ReadOnly (case-sensitive)
   Validate Scripts - Not supported right now
   OnChange Scripts - Not supported right now
   Methods - Context is not the same as in CRM. So things like CRM.GetContextInfo will not work as if it was in CRM except for the user entity. We have created a method called "GetContextInfo" that will work based on the context that a screen is called from (EG company/person). "CRM.FindRecord" and "CRM.CreateQueryObj" will also work. 

PLEASE NOTE:

Fields like "oppo_description" that are key fields and are set based on the email. So for those fields "DefaultValue" will not work.

Sample code:

1.

 Channelscript.png
 var __uid=GetContextInfo("company", "comp_primaryuserid");
 var __qu=CRM.FindRecord("user","user_userid="+__uid);
 if (!__qu.eof)
 {
   var chid=new String(__qu("user_primarychannelid"))
   var __ch=CRM.FindRecord("channel","Chan_ChannelId="+chid);
   DefaultValue={text: __ch("Chan_Description"), value: chid};
 }


2.

 Assignediserscript.png
 var __pid=GetContextInfo("company", "comp_primaryuserid");
 var __ufxsql="select User_FullName from vUsers where User_UserId="+__pid;
 var __ufxquery=CRM.CreateQueryObj(__ufxsql);
 __ufxquery.SelectSQL();
 DefaultValue={text: __ufxquery("User_FullName"), value: __pid}

3. New Company Screen

This screen is made up of a number of screens and some hard coded sections.

a. Company

  CompanyOfficeIntNew

b. Address

  AddressOfficeInt

c. Person

  PersonOfficeIntSmall

d. Person Phone

  This reflects what is seen in Sage CRM itself

e. Person Email

  This reflects what is seen in Sage CRM itself

4. Workflow

The New UI will fetch all existing workflows based on the following example SQL

EG

 select Work_Description, Work_WorkflowId 
 from workflow 
 where Work_Enabled='Y' and Work_WorkflowId in (select distinct WkRl_WorkflowId 
 from WorkflowRules 
 where WkRl_RuleType='Pre' and WkRl_Enabled='Y' 
 and WkRl_Entity='opportunity') 

This gives the workflows that we then fetch the entry "state" for

EG

 select WkSt_Name 
 from WorkflowState 
 where (WkSt_IsEntryPoint is null or WkSt_IsEntryPoint='N') 
 and WkSt_WorkflowId=2 and WkSt_StateId in (select top 1  
 WkTr_NextStateId 
 from vWorkflowTransitionsRules WITH (NOLOCK) where WkTr_WorkflowId=2
 and WkTr_NextStateId is not null 
 order by WkTr_TransitionId)

EG

Sqlworkflow.png

and these workflows and states are used when the given entity NEW screen is displayed. If there is no data then no workflow section is displayed.

Workflowsection.png