Monday, October 21, 2024

CSS Styling

Styling:

1. Inline Styling:

<div style="font-size: 2rem;font-weight: 400;">Good Evening</div>


2. Using CSS class:

HTML:

<div class="time"> 8:15 PM </div>

 CSS:

.time {

    font-size: 5rem;

    font-weight: 600;

}

 3. By importing the CSS file:

Create a component that contains a CSS file and configuration file. Then import it in the component you want to use the CSS file in.

@import 'c/stylingCSS';

 4. By uploading CSS file in Static resources:

import {LightningElement } from 'lwc';

import StaticCSS from '@salesforce/resourceUrl/StaticCSS';

import {loadStyle} from 'lightning/platformResourceLoader';

 

export default class ToDoManager extends LightningElement {

    connectedCallback(){

        loadStyle(this, StaticCSS);

    }

} 

Vlocity Omnistudio Documentation

Data raptor documentation:

https://www.omnistudiofacts.com/post/using-formulas-in-dataraptors

1.

To Find the DR which is send data to docusgn:

Omniscript --> Enrollment/MEWA_IN_GA --> MEWA_All_States_docusign1 (OS) --> DocuSignEnvelopeAction_OH_SOCA_2023 (DocuSign Envelop action) -->find "DR Interface"


Exercise on Ominscript + IP + DR

 

 

2.

Reduce space between the elements from Omniscript add below Styling in the "CUSTOM HTML TEMPLATES" in script configuration Omniscript

<style>

ng-form#DocumentsToSend_VA\|0 ul.slds-form-element.ng-scope {

    padding-bottom: 0 !important;

}

ng-form#DcoumentsToSend_OH\|0 ul.slds-form-element.ng-scope {

    padding-bottom: 0 !important;

}

ng-form#DcoumentsToSend_OH_SOCA\|0 ul.slds-form-element.ng-scope {

    padding-bottom: 0 !important;

}

</style>

 

 

Remote action :

 private Boolean transformABFMedProducts(Map<String,Object> inputMap, Map<String,Object> outMap, Map<String,Object> options){

        system.debug('inside transformABFMedProducts '+inputMap);

        taskType = (String)options.get(TASK_TYPE);

        if(options.containsKey(WITH_QUOTING) && (Boolean)options.get(WITH_QUOTING))  {

            outMap.put(FINALMEDPLN1,String.isNotBlank((String)options.get(ABFMEDPLAN1)) && !(PRINT.equalsIgnoreCase(taskType)) ? ((String)options.get(ABFMEDPLAN1)).replace(PERCENT,PERCENTSIGN) : (String)options.get(ABFMEDPLAN1));

            outMap.put(FINALMEDPLN2,String.isNotBlank((String)options.get(ABFMEDPLAN2)) && !(PRINT.equalsIgnoreCase(taskType)) ? ((String)options.get(ABFMEDPLAN2)).replace(PERCENT,PERCENTSIGN) : (String)options.get(ABFMEDPLAN2));

            outMap.put(FINALMEDPLN3,String.isNotBlank((String)options.get(ABFMEDPLAN3)) && !(PRINT.equalsIgnoreCase(taskType)) ? ((String)options.get(ABFMEDPLAN3)).replace(PERCENT,PERCENTSIGN) : (String)options.get(ABFMEDPLAN3));

            outMap.put(FINALMEDPLN4,String.isNotBlank((String)options.get(ABFMEDPLAN4)) && !(PRINT.equalsIgnoreCase(taskType)) ? ((String)options.get(ABFMEDPLAN4)).replace(PERCENT,PERCENTSIGN) : (String)options.get(ABFMEDPLAN4));

        }else{

            outMap.put(FINALMEDPLN1,String.isNotBlank((String)options.get(NQABFMEDPLAN1)) && !(PRINT.equalsIgnoreCase(taskType)) ? ((String)options.get(NQABFMEDPLAN1)).substringAfter('-').replace(PERCENT,PERCENTSIGN) : ( String.isNotBlank((String)options.get(NQABFMEDPLAN1))? ((String)options.get(NQABFMEDPLAN1)).substringAfter('-') : (String)options.get(NQABFMEDPLAN1)));

            outMap.put(FINALMEDPLN2,String.isNotBlank((String)options.get(NQABFMEDPLAN2)) && !(PRINT.equalsIgnoreCase(taskType)) ? ((String)options.get(NQABFMEDPLAN2)).substringAfter('-').replace(PERCENT,PERCENTSIGN) : ( String.isNotBlank((String)options.get(NQABFMEDPLAN2))? ((String)options.get(NQABFMEDPLAN2)).substringAfter('-') : (String)options.get(NQABFMEDPLAN2)));

            outMap.put(FINALMEDPLN3,String.isNotBlank((String)options.get(NQABFMEDPLAN3)) && !(PRINT.equalsIgnoreCase(taskType)) ? ((String)options.get(NQABFMEDPLAN3)).substringAfter('-').replace(PERCENT,PERCENTSIGN) : ( String.isNotBlank((String)options.get(NQABFMEDPLAN3))? ((String)options.get(NQABFMEDPLAN3)).substringAfter('-') : (String)options.get(NQABFMEDPLAN3)));

            outMap.put(FINALMEDPLN4,String.isNotBlank((String)options.get(NQABFMEDPLAN4)) && !(PRINT.equalsIgnoreCase(taskType)) ? ((String)options.get(NQABFMEDPLAN4)).substringAfter('-').replace(PERCENT,PERCENTSIGN) : ( String.isNotBlank((String)options.get(NQABFMEDPLAN4))? ((String)options.get(NQABFMEDPLAN4)).substringAfter('-') : (String)options.get(NQABFMEDPLAN4)));

        }

        return true;

 

    }

 

Extract DR:

Step 1



 

Step 2



 

Step 3


Omni studio Interview questions:

  • Scenario based on Vlocity
  • Data raptor?
  • Integration procedure?
  • Flex cards?
  • Best practices in omni studio?
  • Reusable ip?
  • 8. How to improve the performance of Omniscript?
    1. Reduce Conditional Views,
    2. Trim JSON response
    3. Reduce number of elements.
  • 9. What is the difference between Salesforce Screen flow vs Omniscript?
  • 12. What is the use of Remote Action?
  • How to include Omniscript in Community?
    1. From Setup, in the Quick Find box, search for Digital Experiences and then select All Sites.
    2. Next to your site name, click Builder.
    3. Create or go to the page where you want to add an OmniScript form.
    4. drag the OmniScript component onto the content area of the page..
    5. To identify which OmniScript to use in the component, in the properties panel, select the Type, SubType, and Language that you specified when you created the OmniScript form.
    6. Repeat to add other forms to your site as necessary.
    7. Preview your changes and publish them when you're finished.

 

  • 14, Ip in Synch, Ip in async(is chainable, is queueable) -- execution time is less
  •  Omniscript -- Http action ?
  • Try catch block ?
  • Save options  --- save for later option enable?
  • Ip in ip?
  • IP : Output Response   -- Return Only Additional Output?
  •  implements vlocity_ins.VlocityOpenInterface?
  • Classic lightning conversion  Omniscript?
  • Omniscript LWC include vice versa?
  • How to identify the Json whether Json from DR or apex?
  • Ip in apex?
  • What is the difference between Salesforce Screen flow vs Omniscript?

Screen flow is better for simpler forms that only interact with Salesforce data, and where the exact look and feel isn’t so important. Think more general internal (employee) forms  –  such as feedback forms or IT support requests.

 

OmniScript is better for more complex, higher-value interactions and/or where branding is important. Think industry-specific, consumer-facing processes, such as signing up for a mobile phone plan or requesting an increased credit card limit.

 


 

 

  • How to convert multiple lists into one list:

LISTMERGE("ProductSiteName",LIST(%QuoteLine%))

https://salesforce.stackexchange.com/questions/421165/group-by-a-field-with-a-dataraptor-transform

 

  • How to call Data raptor into apex:

string DRname = 'MRK_Test';

map<string, object> input = new map<string, object>();

omnistudio.DRProcessResult drProcessResult = omnistudio.DRGlobal.process(input, DRname);

list<map<string, object>> resultJson = (list<map<string,object>>)result.toJsonList();

system.debug('resultJson=='+resultJson);

 

  • What is the need of is Lookup option in Load data raptor:

Insert contact record, need to update the email address from user object we can do with no need to query the user record.

Assign the value from user object

 

  • Can we call reusable Omniscript into another reusable Omniscript?

No

 

  • How to resolve the System timeout/CPU timeLimit issues in vlocity?

Apex

  • Salesforce platform imposes a CPU usage governor limit to any given execution context, which is approximately 10 seconds. It means that Apex Code, declarative tools or a combination in a transaction, must not exceed a ~10-second limit. The CPU time error is contained within Salesforce Governor Limits.
    • 5 Things to Know
      • The error also involves declarative tools. It is calculated for the executing Apex code and any processes that are called from this code, such as package code, and Flows. Thus it is not merely for Apex as the name entitles.
      • It is shared with certified managed packages. The certified managed package is a package that has passed the security review for AppExchange. It has its own set of limits for most per-transaction limits. However, Apex CPU Time Limit is an exception.
      • It is non-negotiable. This means we cannot increase the 10-second threshold by tweaking settings, buying more allocations from Salesforce or work around it by other means. It is an absolute hard limit.
      • It shuts down the execution immediately. It is a full stop.
      • It rolls back all database transactions. For example, you might have done multiple DMLs successfully in the transaction. These DMLs are reverted when this limit hits.
  • Simple way :
    • Trigger logic enters unexpectedly multiple times. Trigger logic finishes first, workflow follows to update
    • Nested loops
    • Code in Managed package

Omniscript

  • Optimize DataRaptor and Integration Procedures : minimize the number of fields retrieved and processed
  • Break Down Complex Scripts
  • Use Caching : where ever required use it
  • Monitor and Debug:
  • Adjust Timeout Settings: In scrpt configuartion --> persistant component --> Remote Timeout (ms) -->30000(30 ms defalt) --> can increase
  • Review Governor Limits:
  • Review Governor Limits:

 

 

  

Wednesday, November 2, 2022

Salesforce Order of execution

 Before Salesforce executes these events on the server, the browser runs JavaScript validation if the record contains any dependent picklist fields. The validation limits each dependent picklist field to its available values. No other validation occurs on the client side.


1. System Validation Rules.

2. Executes all before triggers.

3. Custom Validation rules.

4. Executes duplicate rules. If the duplicate rule identifies the record as a duplicate and uses the block action, the record is not saved and no further steps, such as after triggers and workflow rules, are taken.

5. Saves the record to the database, but doesn't commit yet.

6. Executes all after triggers.

7. Executes assignment rules.

8. Executes auto-response rules.

9.Executes workflow rules.

10.  If there are workflow field updates, updates the record again.

11.  If the record was updated with the workflow field update, it fires before and after triggers one more time (and only one more time) with standard validation rules. Custom validation rules, duplicate rules, and escalation rules are not run again.

Note:
If there were multiple field updates which updated the record, before and after triggers with standard validation rules will be fired only one time.

12. Executes processes and flows launched via processes and flow trigger workflow actions. When a process or flow executes a DML operation, the affected record goes through the save procedure.

13. Executes escalation rules.

14. Executes Entitlement Rules.

15. If the parent record is updated, and a grand-parent record contains a roll-up summary field or is part of a cross-object workflow, performs calculations and updates the roll-up summary field in the parent record. Grand-parent record goes through save procedure.

16. If the record contains a roll-up summary field or is part of a cross-object workflow, performs calculations and updates the roll-up summary field in the parent record. Parent record goes through save procedure.

17. Executes Criteria Based Sharing evaluation.

18. Commits all DML operations to the database.

19. Executes post-commit logic, such as sending email.

Apex life hacks

Dynamic string formation: --> \'\' --> \'''\' -->  \''+ +'\' --> \''+ test.Name +'\'

Query Custom Setting Records :

String regionQuery = 'SELECT Id, Name  FROM TestCustomSetting__c';

List<TestCustomSetting__c>  regionCustomSettings= Database.query(regionQuery);


Map<String, TestCustomSetting__c> countryMatrix = new Map<String, TestCustomSetting__c>();

        for(TestCustomSetting__c region : regionCustomSettings){

            countryMatrix .put(region.Name, region);

        }

system.debug('countryToRegionTaskMatrix==>'+countryToRegionTaskMatrix);

MAP: 

https://www.infallibletechie.com/2012/10/map-datat-type-in-salesforce.html

https://salesforce.stackexchange.com/questions/223189/get-values-from-a-map-in-apex

SObject Query:

         String typeName = 'Test__c';

        SObjectType objectType = Schema.getGlobalDescribe().get(typeName);

        Map<String,Schema.SObjectField> objectFields = objectType.getDescribe().fields.getMap();

        String query = '';

        Integer fieldCount = 0;

        for (Schema.SObjectField objectField : objectFields.values()) {

            if ('' + objectField != 'Test__c') {

                query += objectField + ' ';

                if ( fieldCount < objectFields.values().size() - 1) {

                    query += ', ';

                }

            }

            fieldCount++;

        }

     system.debug('query==>'+query);


Try catch exception Handling using System. debug:
       try{
           
        }
        catch(Exception objEx){
            System.debug(LoggingLevel.ERROR,objEx.getStackTraceString() +'\n'+ objEx.getMessage());
        }


Resolve RowCause in Apex class:
Remove "With sharing" from apex class 

For loop:
https://salesforce.stackexchange.com/questions/129706/which-one-is-better-loop-with-soql-or-create-a-list-then-loop

Monday, May 30, 2022

Salesforce Vlocity Omni studio

Vlocity Org Creation:

Steps to create New vlocity salesforce org :

What is vlocity:

1.     Vlocity is natively built on salesforce platform and it is leading provider of industry-specific solutions

2.     Industry-specific means that is addresses aspects of a specific industry

3.     the main purpose to acquire the vlocity is Customer 360 (Initial salesforce handle sales, service, marking, community clouds etc... once acquire this vlocity then salesforce handles the industries side, we call it as customer 360).

a.     communications

b.     media & entertainments

c.     energy & utilities

d.     insurance

e.     health

f.      Government

Vlocity mainly based on below concepts

  • Data raptor
  • Integration Procedure
  • Omni Scripts(Classic and LWC Enabled)
  • Vlocity Cards/flex cards

                                                                              

Data raptor : 


Data raptor is a mapping tool that enable to read, transform and write salesforce data. 

  • Tab Name: Vlocity Data Raptor Designer
  • It is a Service management and need to write the backend logic for CRUD Operations.
  • It is a SOQL or DML, if we get the data from salesforce or perform any DML operation we can use data raptor.
  • *Date raptor cannot run in the Without sharing accepts.
  • Using Data raptor, we can’t the delete the records, if delete any record use the IP or OS.
  • when user changes some data or enters new data, it must be saved too.

      Four types of data raptors

a.     Extract: 

i. This data raptor extracts read salesforce data and return results in JSON, XML or custom formats.

ii. Perform multiple objects SOQL's in single datarptor.

b.     Transform:

i. Intermediate data transformations without from or writing to salesforce

ii. Convert JSON input to XML Output and vice versa

iii. Restructure input data and rename fields

iv. Substitute values in fields

v. No filtering provided for this DR

c.     Load:

i. Perform DML Operations

d.     Turbo extract

i. Perform single object SOQL in single dataraptor.

ii. We cannot retrieve the child records but can retrieve the parent record data


 Key Points in Dataraptors:

1. Id should not be null.. to checking the ID write like this for Ex: Contacts Id <> "$Vlocity.NULL"


Note : 
i. "Contacts" is a refence JSON node
ii. If you want to make Dynamic id through in where condition put ex : recId and  pass it in the Input        Parameters in Preview 
iii. if that recId is want to under any Parent node make it to write like this in where condition ex:                  obj:recId and  pass it in the Input Parameters like below in Preview 
      {
        "obj": {
          "recId": "0015j00000WvgwqAAB"
        }
      }

Quick Match button: Using this we can map the JSON from Expected JSON Output to output parameters.

Extraction step JSON : Salesforce provide the data
Expected JSON Output : If we have predefined JSON code that we can map to as output parameters 
Current JSON Output : Based on the mapping shows the JSON pattern


 

Integration procedure (IP):



·       Tab Name: omnistudio integration procedure 

·       Server-side actions. handled the multiple server-side actions in single server call.

·       Need to activate

·       Call the apex class, HTTP action, we service class

·       Dr_getAccountDetails

                         a.          Data Raptor interface: provide Data raptor name


Omni Scripts :


Tab Name : Vlocity OmniScript Designer

1. LWC Enabled Omni Scripts:

     ·       It will Support the Lwc templates

·       Supported placeholders for text inputs

 2. Classic Omni Scripts:

·       Omni Scripts nothing but do some procedure step by step wise

·       It will Support the Angular template and visual force pages

·       Use Help text

·       To save the data into database use Dataraptor post action


Vlocity cards:


  Tab Name : Vlocity Cards

·       Vlocity cards --> built on angular JS framework

o   Flyout cards -> to show some part of information

·       Flex cards -> built on LWC


LWC Conversion:







 

 

CSS Styling

Styling: 1. Inline Styling: < div style = "font-size: 2rem;font-weight: 400;" > Good Evening </ div > 2. Usi...