Wednesday, March 8, 2023

What is test class in salesforce? How to test callouts using HttpCalloutMock Interfaces?

 Test class is a critical component of the development process. 

Why it is necessary to write test class in salesforce?

For the development of robust, error-free code, It is necessary to have some mechanism which ensures whether a particular piece of code is working properly or not and for that Apex supports the creation and execution of unit tests. Unit tests are class methods that verify whether a particular piece of code is working properly. Unit test methods take no arguments, commit no data to the database.

Now, let us take a look at the important annotations in test class.

Test methods are flagged with the @IsTest annotation in the method definition. Unit test methods must be defined in test classes, that is, classes annotated with @IsTest.

@IsTest

private class SampleTestClass {

   // Methods for testing

   @IsTest static void testMethod1() {

      // code here

   }

   @IsTest static void testMethod2() {

      // code here

   }

}

Earlier we also used to have testMethod keyword which was used to define apex test methods.

@isTest

public class SampleTestClass {

static testMethod void testmethod1() {

// code here

}

}

Note:

The testMethod keyword is now deprecated. Use the @IsTest annotation on classes and methods instead. The @IsTest annotation on methods is equivalent to the testMethod keyword.

When deploying apex to a production organization unit tests must cover at least 75% of your Apex code. While only 75% coverage is needed to deploy apex class to production we should not bound ourselves to cover 75% only instead make sure that every use case of your application is covered, including positive and negative cases, as well as bulk and single records.

Test classes best practices:

1) We should always considered doing testing with bulk records.

2) We Should test "test cases" for both positive and negative test scenario.

3) Avoid using (SeeAllData=true) in test class because it might happen that the test class pass in sandbox but fails in production if data is not present in production.

4) Avoid using hardcoded id's in  test class.

How to test callouts using HttpCalloutMock Interfaces?

By default test methods cannot be used to test Callouts, so tests that perform callouts fails. Instead, use mock callouts. 

Testing HTTP Callouts by Implementing the HttpCalloutMock Interfaces.

The class that implements the HttpCalloutMock interface can be either global or public.

You can annotate this class with @isTest since it will be used only in test context. In this way, you can exclude it from your organization’s code size limit of 6 MB.

Sample syntax:

global class TestHttpCalloutMockImpl implements HttpCalloutMock {

    global HTTPResponse respond(HTTPRequest req) {

        // Create a fake response.

        // Set response values.

        // return response.

    }

}

Now, let us understand with an example below,

Apex class doing callout:

public class SampleCalloutApexClass {

    public static HttpResponse getDataFromExternalSystem() {

        HttpRequest req = new HttpRequest();

        req.setEndpoint('https://SomeInstance.com/example/test');

        req.setMethod('GET');

        Http h = new Http();

        HttpResponse res = h.send(req);

        return res;

    }

}

Implementing the HttpCalloutMock Interfaces

@isTest

global class TestMockHttpResponseGeneratorImpl implements HttpCalloutMock {

    global HTTPResponse respond(HTTPRequest req) {

       // Creating a fake response

        HttpResponse res = new HttpResponse();

      // Setting response values

        res.setHeader('Content-Type', 'application/json');

        res.setBody('{"example":"test"}');

        res.setStatusCode(200);

      // return response.

        return res;

    }

}


Test Class:

@isTest

private class SampleCalloutApexClassTest{

     @isTest static void testCallout() {

        Test.setMock(HttpCalloutMock.class, new TestMockHttpResponseGeneratorImpl ());

        HttpResponse res = SampleCalloutApexClass.getDataFromExternalSystem();

        String contentType = res.getHeader('Content-Type');

        System.assert(contentType == 'application/json');

        String actualValue = res.getBody();

        String expectedValue = '{"example":"test"}';

        System.assertEquals(actualValue, expectedValue);

        System.assertEquals(200, res.getStatusCode());

    }

}

Saturday, February 18, 2023

What are scratch orgs in salesforce and how to create scratch org in salesforce?

In this blog post we are going to discuss about scratch orgs in salesforce.

Basic Details:

Scratch org is a disposable salesforce org used for development and testing. 

By default, they do not contains sample data, workflows, profiles, permission sets, apex classes, triggers, pages. In short scratch orgs are empty and they don’t contain much of the sample metadata that you get when you sign up for an org, such as a Developer Edition org.

Each developer could have their own scratch org to increase productivity or you can share the scratch org configuration file with other team members, so you all have the same basic org in which to do your development. 

Scratch orgs have these storage limits:

200 MB for data
50 MB for files

Scratch Org Expiration Policy:
  1. Scratch org can be created for a maximum of 30 days after which scratch org gets deactivated. 
  2. You can select a duration from 1 through 30 days at the time of creation. 
  3. Default duration for Scratch org is 7 days. 
  4. After the scratch org has expired, you can’t restore it.
On Which Salesforce Instances Are Scratch Orgs Created?

Scratch orgs are created from Dev Hub. Your Dev Hub org is often your production org or a separate developer org. Your Dev Hub edition determines how many scratch orgs you can create or how many can be active at a given time.

What are differences between Scratch Org vs Sandbox?

The main difference between scratch org and sandbox is your sandbox is linked to your production org and it copy metadata from production environment and can contains records copied from production environment in case of partial or full copy sandbox whereas by default scratch org is empty.

Scratch Org Creation:

Before you create a scratch org:
  • Set up your Salesforce DX project
  • Authorize the Dev Hub org
  • Create the scratch org definition file
The Dev Hub org allows you to create, delete, and manage your Salesforce scratch orgs. After you set up your project on your local machine, you authorize with the Dev Hub org before you can create a scratch org.

You can also authorize other existing orgs, such as sandbox or packaging orgs, to provide more flexibility when using CLI commands. For example, after developing and testing an application using scratch orgs, you can deploy the changes to a centralized sandbox. Or, you can export a subset of data from an existing production org and import it into a scratch org for testing purposes.

For more details on how to "Authorize the Dev Hub org" please visit How to authorize the dev hub org in salesforce?

Now press CTRL+SHIFT+P and search for "Create a Default Scratch org.." and click it and select the file available as shown in the below images.

visual studio code salesforce setup


how to use visual studio code for salesforce

Specify the name and the days after which the Scratch org will expire. Now we can see that the Scratch org is getting created as shown in below image.

how to use visual studio code for salesforce

After the Scratch org is created successfully press CTRL+SHIFT+P  and type "SFDX:Open Default Org ". It will open the Scratch org in new console as shown below.

Scratch org in Salesforce using Visual Code Studio

What are Lightning Web Components?

Before going into details on  What are Lightning Web Components? first let us understand What are Web Components?

Web components are a set of web platform APIs that allow you to create new custom, reusable, encapsulated HTML tags to use in web pages and web apps. Custom components and widgets build on the Web Component standards, will work across modern browsers, and can be used with any JavaScript library or framework that works with HTML.

The concept was first introduced in 2011 by Google engineer Alex Russell.

It was in 2013 when Google and the Chrome team developed the first version of this Web Components standard, the V0 version.

It was between 2016 and 2018 when everything changed, Google introduced the Web Components V1 standard, which was adopted by most modern browsers.

Why Web Components?

Let say we select a framework today and tomorrow we want to move to some other framework and share business logic and functionality between different projects however, this might force us, in many occasions to re-code tools and functionalities to adapt them to new projects or services.

This is where Web Components comes into play. Web Components is a tool that allow us to create tools and functionalities that we can use on any framework and on any browser and that are implemented under a standard accepted by the whole community.

Now, as we have the basic idea on what are Web Components let us move on to our topic of discussion What are Lightning Web Components?

As of now, we have built lightning components using the "Lightning Component Framework" using "Aura Component Model" similarly, we can also built lightning components using the "Lightning Web Component Framework". 

Lightning Web Component Model is a new programming model built using the HTML Elements and modern JavaScript. It uses core web component standards and leverages custom elements, templates, decorators, modules, shadow DOM, and other new language constructs available in ECMAScript 7 and beyond.

For developing LWC we require "Salesforce Extensions for Visual Studio Code" and for deploying LWC to an org we require "Salesforce CLI".

Why Salesforce has come up with Lightning Web Component Framework?

Earlier salesforce developers used Visual Force pages which is an HTML Tag-based mark-up language to develop web pages and Apex to perform database operations however it  was not compatible to build large scale enterprise solutions and complex applications using Visual Force pages.

In 2014, Salesforce launched the "Lightning Component Framework" along with "Aura Component Model" that is used to develop large scale enterprise solutions and complex applications.

In 2014, web standards only offered a limited foundation for the full stack that developers need to build large-scale web applications, i.e. a rendering engine, standard elements, events, and a core language (ECMAScript 5) and the key elements like a component model, templates, modules, and shadow DOM were all missing from the web standards.

Since then there has been a lot of improvement in the Web Components and to keep up the pace and standardization’s of the Web Components according to the huge demand of the web Components across the internet salesforce moved from "Lightning Component Framework" to "Lightning Web Components Framework".

We can built components using any of the model and can place these components on the same lightning page. Both Aura component, LWC make use of Security, LDS and Base lightning components.

LWC vs AURA:

Below are the advantages of using LWC over AURA.

  1. Improved performance
  2. Faster loading sites
  3. Better security, testing, and browser compatibility
  4. Can be used under AURA.

Important points to note:

1) Aura component and LWC can exist on Same lightning page.

2) Aura component can include LWC

What are sharing rules in salesforce and how to create sharing rule?

Sharing rules helps users gain access to records which they were not able to access based on OWD settings or role hierarchy setup. In simple term it simply allows greater access for particular users.

There are three types of sharing rules:

Owner-Based Sharing Rules:

An owner-based sharing rule opens access to records owned by certain users. 

For example, a company’s sales managers in region one need to see opportunities owned by sales managers in region two. 

The sales manager in region two could give the sales manager in region one access to the opportunities owned by region two team using owner-based sharing.

Criteria-Based Sharing Rules:

A criteria-based sharing rule determines with whom to share records based on field values. A criteria-based sharing rule is based on record values and not the record owners. 

For example, you have a custom object for Branch applications, with a custom picklist field named “Department.” 

A criteria-based sharing rule could share all Branch applications in which the Department field is set to “IT” with all IT professors in your organization.

Note: We cannot use Apex to create a criteria-based sharing rule. and we cannot test criteria-based sharing using Apex.

Guest User Sharing Rules:

It is a special type of criteria-based sharing rule and the only way to grant record access to unauthenticated guest users.

Note:

1) The guest user sharing rule type grants access to guest users without login credentials.

2) By creating a guest user sharing rule, you're allowing immediate and unlimited access to all records        matching the sharing rule's criteria to anyone and hence to secure your Salesforce data and give              your guest users access to what they need, it is necessary to consider all the use cases and                        implications of creating this type of sharing rule.

Now, Let us see how to create sharing rule.

1) From Setup, in the Quick Find box, enter Sharing, then select Sharing Settings.

2) Under Case Sharing Rules, click New.

Below is the image showing the details which are needed to be filled while creating sharing rule.

The image shows sharing rule screen for creating sharing rule for case object.

How to create sharing rules in Salesforce?

When we select rule type as "Based on record owner" we need to specify owner of the record whos record we are trying to share. The owner can be from anyone shown below.

Owner-based sharing rules in Salesforce

We also need to specify the users with whom we want to share the records. The users can be anyone shown below.

How to create ownership based sharing rules in Salesforce


When we select rule type as "Based on criteria" we need to specify the criteria and the the users with whom we want to share the records.

What is criteria-based sharing rules Salesforce

Thursday, February 9, 2023

Salesforce Vlocity Interview Questions On Order Management Updated 2023

1) What is decomposition relationships?

Industries Order Management uses decomposition relationships to define these rules that are needed to decompose the commercial order into sub-orders, called fulfillment requests, tailored for specific downstream systems.

Information from fields, attribute from commercial order is copied to attribute on fulfilment requests.

In short, Order decomposition breaks down the original commercial order into technical orders that are custom-designed for fulfillment systems according to use case requirements. The Order Decomposition process does not modify the original order. Instead, the process generates a set of Fulfillment Requests (FR), each containing Fulfillment Request Lines (FRL).

We can interpret FRL is a wrapper for the technical product specification defined in the catalog in a similar manner in which the Order Item is a wrapper for the commercial product specification.

FRL action is identified during the decomposition process based on analysis of the current technical inventory in a similar manner in which the Order Item actions are derived from assets.

Salesforce Vlocity Interview Questions on Order Management

2) What are different types of decomposition relationships?

Basically there are three types of decomposition relationships.

a) One-to-One Decomposition:

A common use case for a one-to-one order decomposition involves an offer containing multiple products of the same type that must be activated individually.

b) One-to-Many Decomposition Relationship:

A common use case for a one-to-many order decomposition is an offer containing a product that affects multiple fulfillment systems i.e that needs to be provisioned to multiple systems.

For example: A product which needs to be activated in network and has an OTC or MRC charge that needs to be sent to billing system.

So in the above use case we will need to create two technical products one of which will hold information needed by networking system and the other will hold the OTC or MRC charge for billing system.

c) Many-to-One Decomposition Relationship:

A common use case is a fulfillment system that requires information defined on a different commercial order items in single request. So in this case we will need to decompose multiple commercial products into single technical product.

This type of decomposition is generally achieved by using scope on technical product as “Account” or “Order Item".

For example, let say one of the commercial product hold Data/SMS/MIN value and the other hold the information say SIM details.

In the above use case we will create two decomposition relationship one from first commercial product which will map DATA/SMS/MIN to technical product attributes and other from second commercial product which will map SIM details to technical product attribute and then the information can be send to downstream system from technical product in a single request.

d) Multi-Level Decomposition Relationships:

Lastly, we can also create multi-level decomposition relationships. They are comprised of 1:1, 1:M, and/or M:1 relationships.

The need of multi-level decomposition arise when single level decomposition relationship is not sufficient to decompose commercial product into desired technical product.

As a best practice, a maximum of four levels is recommended.

Salesforce Vlocity XOM Interview Questions



                                      Multi-Level Decomposition Relationships

3) What is product class and when to use it?

By default, when we create a new product using the Product Console, the Record Type is set to Product however “Product Class” is an abbreviated way to refer to a product with the Record Type as Class.

Product Class is neither a commercial product nor a technical product, simply it's a mechanism used by Industries Order Management to categorize certain products in order to simplify the order decomposition configuration process.

The need of product class arise when there are multiple commercial product and decomposition behavior is same for all i.e all decompose similarly to technical product.

Let say we have 100 commercial product in that case will need to create 100 decomposition relationship to decompose the commercial product to technical product. Isn’t this process time consuming?

Implementing decomposition by Product Class includes three main steps:

1) Create the Product Class.

Create a product and set the record type to Class.

2) Associate similar commercial products with the Product Class.

This is done by setting the commercial product's Parent Class field to a product created in step 1 with a record type of Class.

3) Create a single decomposition relationship from product class to technical product.

4) What are primary functions we perform using industry order management?

1) Order decomposition  

2) Order Orchestration

5) What is order orchestration?

Once the order decomposition is completed the next step is the order orchestration.

Orchestration is basically a process of communicating with external systems to send the necessary information needed by the external system to process the order.

Example of external system include billing, network activation, inventory management.

6) Is it necessary to perform order decomposition?

The main purpose of the order decomposition is to accumulate the necessary information from fields/attributes from different commercial products into attributes on technical products and then send the necessary information to external system for provisioning.

order decomposition is optional and is explained using the example below.

Sometime the integration with external system is so complex that it is necessary to break the commercial information from different commercial products or single commercial product into different technical products or single technical product as per the need of external system. In order to achieve this type of integration in simpler way it is necessary to make use of decomposition process  to map the necessary information on technical product and then which can be used to communicate with external system however sometime the integration with external are simple and can be easily achieved based on the information available on commercial product and in this type of scenario we do not need decomposition.

7) Is it ok to map the action parameter from commercial product to technical product in decomposition?

we should avoid mapping the action parameter from commercial to technical product. This is explain using the below example.

Let say you have a commercial product "Bill Plan" which has DATAMINS and SMS as an attribute. Let say you created a technical product called "Bill Plan TP" which has DATA_TPMINS_TP as an attribute. 

Note : We are not mapping SMS attribute from commercial to technical product. Let say the downstream system for which technical product is created does not need SMS value.

Let say you map commercial product "Bill Plan" attribute DATAMINS to technical product "Bill Plan TP" attribute DATA_TPMINS_TP. In this case initially in base order our order item(Bill Plan) and fulfilment line item (Bill Plan TP) both will have add action and accordingly once order is assetized the asset and inventory would be created.

Now, let say we raised another MACD for bill plan change where we are modifying the attribute SMS on commercial product "Bill Plan".

So in the above case in cart we will be able to see the action Change on "Bill Plan" order item and action on fulfilment "Bill Plan TP" will be still NoChange this is because there is no change that has happened to commercial product "Bill Plan" attribute DATAMINS which is mapped to "Bill Plan TP" attribute DATA_TPMINS_TP however if we would have mapped the action parameter as well from order item to fulfilment line item it would have resulted in Modify action on fulfilment line item as well which can result in error if we have callout that need to be executed based on Modify action on fulfilment line item.

8) What are conditions and mapping rules while creating decomposition relationship?

A condition rule places a condition on the decomposition relationship. Order Management initiates decomposition of an order item only if the specified condition evaluates as true. Otherwise, Order Management skips the decomposition relationship.

Note: The conditional rule is optional.

Mapping Rules provide a way to pass the attributes from your commercial products to technical product attributes.

There are three different types of Mapping Rules.

a) Ad-verbatim : Here the value of the source attribute is copied as is to the destination attribute.

b) List : For a given list mapping, the source value is set to the corresponding destination value.

Example : Let say you have 2 values on commercial side on an attribute as Gold, Silver and let say you have 2 values on technical side on an attribute as 100 GB and 50 GB.

Using list mapping type we can map GOLD to 100 GB and Silver to 50 GB.

c) Static : Here we can specify any value on technical product attribute directly.

Note: The mapping rule is mandatory.

9) What is the need of setting product scope on technical product?

Order Management generates Fulfillment Request Lines (FRL) from order items as a result of the decomposition process. 

Sometimes there is a need to create one fulfillment request line (FRL) from particular order item which we call as 1:1 decomposition 

or Sometimes there is a need to create multiple fulfillment request lines (FRL) from one order item which we call 1:M decomposition 

or Sometimes there is a need to create one fulfillment request line (FRL) for multiple order items which we call as M:1 decomposition.

The above behavior is controlled by using scope field on product2 object.

The Scope field appears for all products, whether they are commercial or technical. However, Order Management considers Scope only for technical products because they are used in decomposition results.

10) What are different scope available to set on technical product?

Scope has below picklist values:

a) Account

b) Order Item

c) Downstream Order Item

d) Top Order Item

e) Order

11) Explain what is Account scope?

If we set the Scope for a technical product to Account it creates a single instance of the technical product Fulfillment Request Line. Only one inventory item for the technical product exists for the given account. If there is another order requesting the same bundle, then the decomposition process generates a FRL based on the existing inventory item.

Salesforce Vlocity XOM Interview Questions



12) Explain what is Order scope?

If we set the Scope for a technical product to Order creates a single instance of the technical product (Fulfillment Request Line) per order. But, unlike the Account scope, for every subsequent order that requests the same bundle, one inventory item fulfillment request per technical product is created.

Salesforce Vlocity Interview Questions On Order Management Updated 2023


13) Explain what is Order Item scope?

As we have seen in the above examples if we set the scope to Account or Order then irrespective of the number of time the bundle is added in Order 1 decomposition always resulted in single technical product getting generated however if we want separate technical product to be created for each bundle as shown in image below then we can set the scope to Order Item. 

Salesforce Vlocity Interview Questions On Order Management Updated 2023


Let us understand this with an example,

I created a bundle with two child products as shown below. I also a technical product called "Technical Amazon Prime". Then I created decomposition relationship from "Amazon Prime" to "Technical Amazon Prime" and similarly I created one more decomposition relationship from "3G Data Plan" to "Technical Amazon Prime".

Salesforce Vlocity Interview Questions On Order Management Updated 2023
Salesforce Vlocity Interview Questions On Order Management Updated 2023



Now, I created an order and added bundle product twice as shown below. Have a look at decomposition shown on right side. The decomposition resulted in a separate technical product for each bundle.

14) Explain what is Downstream Order Item scope?

If we set the Scope for a technical product to Downstream Order Item then it results in no merge of a technical product i.e FRL is created for each commercial instance.

Salesforce Vlocity Interview Questions On Order Management Updated 2023

15) Explain what is orchestration plan definition?


A set of tasks grouped logically together in a plan, used to fulfill orders across one or more fulfillment systems.

16) Explain what is orchestration item definition?

Tasks that make up an orchestration plan definition is called as orchestration item definition.

There are 5 types: 
  1. Milestone.
  2. Auto-Task.
  3. Callout.
  4. Manual Task.
  5. and Push Event.
17) Explain what is orchestration scenario?

Used to determine when an orchestration plan definition should execute. They are tied to a product and an action such as Add, Modify, Disconnect, NoChange, Suspend, Resume.

18) How to configure a callout to send empty attribute values?

In the Details section of the Orchestration Item Definition window for an existing callout, click the pencil icon to the right of Callout Parameters. Now, click Send Empty Values, then click the arrow to move "Send Empty Values" from the Available box to the Chosen box.


Salesforce Vlocity Interview Questions On Order Management Updated 2023



19) What is Staged Assetization?

Staged Assetization is a important concept for long running orders that can take hours, days, weeks or months to complete. Using this concept we can assetize top-level order items and their children even when other top-level order items in the same order are still in process.

As an example, a customer has ordered Mobile SIM CARD for mobile phone and WIFI connection. The order for Mobile SIM CARD finishes quickly, but for WIFI connection, the service provider needs to schedule a technician to go to the customer’s home for installation, which could take a week. In that time the customer decides to buy additional SMS pack for Mobile SIM CARD, as the Mobile SIM CARD has been assetized, the service provider can add the additional SMS pack without waiting for the WIFI connection order to finish.

20) How to configure task in orchestration plan definition for Staged Assetization?

An orchestration item of type Auto Task with the AssetizeOrderItem implementation must be associated with the order item at the required stage of the orchestration plan to assetize the order item.

AssetizeOrderItem must be associated with a root order item, or with a technical order item that's decomposed from a root order item. Any association to a child order item is ignored, and assetization will not occur for any child order items.

Apex Class to be referred in implementation : XOMAutoTaskStagedAssetizer

21) How is orchestration item associated to fulfillment request lines and order items?

If an orchestration plan definition is associated with a technical product in scenario condition, its orchestration items are associated with a fulfillment request line. If an orchestration plan definition is associated with a commercial product in scenario condition, its orchestration items are associated with an order line item.

22) What are different queue types available?

There are three queue types: 

Attributes-Based, 
Round Robin
Least Loaded. 

We need to choose a queue type when defining manual queues and manual tasks.

Attributes-Based : It assigns tasks based on assignment rules that you set. 

Round Robin : It assigns the task to members of the work group in sequence. 

Least Loaded :  It assigns the task to the person with the fewest number of tasks in their queue. 

23) How to launch an omniscript from manual task?

To launch an omniscript from manual task we need to refer the URL obtained from omniscript in "Custom Task Execution URL".

To obtain the OmniScript launch URL:

1) Click the Vlocity OmniScripts Designer tab. 
2) In the Vlocity OmniScripts page, navigate to the desired OmniScript and, if applicable, expand it to view the latest version.
3) Click the name of the OmniScript to open it.
4) In the top-right corner, click the How to Launch the Activate Script button.
5) Select the OmniScript launch URL in the Standalone section and click the Copy to clipboard button. 

Sample URL : 

https://domainname--vlocity-cmt.vf.force.com/apex/vlocity_cmt__OmniScriptUniversalPage?id={0}&layout=lightning#/OmniScriptType/Contract/OmniScriptSubType/Amend/OmniScriptLang/English/ContextId/{0}/PrefillDataRaptorBundle//true

Remove the org ID and the domain name from the URL. Now, copy and paste this updated URL in  manual task item definition field "Custom Task Execution URL".

apex/vlocity_cmt__OmniScriptUniversalPage?layout=lightning#/OmniScriptType/Contract/OmniScriptSubType/Amend/OmniScriptLang/English/ContextId/{0}/PrefillDataRaptorBundle//true

24) Explain the concept of partial assetization of product attributes?

Partial assetization of attributes can only be used on technical products.

You can control which attributes are assetizable by checking the Not Assetizable field on technical product attributes. 

Order Management gives you the option of assetizing some product attributes and not others.

For example, you can create an order with Personally Identifiable Information (PII), such as customer name and customer phone number. This information is required on a one-time basis to create a billing account, and then is no longer needed. You can define the PII attribute on one of the technical products and flag the PII attributes as Not Assetizable. Avoid creating a mapping for this attribute. Instead populate the value during orchestration instead. Doing so ensures that there's no impact in decomposition from this attribute so Order Management doesn't store PII in internal technical inventory or anywhere else on a permanent basis.

25) What we can do to ensure callouts made to a fulfilment system that is unresponsive due to scheduled maintenance does not fail?

Offline Status:

If a fulfillment system is unresponsive, you can set the relevant system interface to Offline.
If we do so it moves those callouts to the On Hold state. 

Updating status to Online:

When the system goes back online, change the system interface back to Online. The callouts then move to the Ready state where they're picked up and orchestrated as usual.

Integration Retry job:

The Integration Retry job is responsible for changing the state of a callout after its system interface is back online. This job checks callouts in the On Hold state to see whether their associated system interface statuses are set to Online. If so, then the job moves the callout to the Ready state.This job runs every minute by default, but you can edit the custom settings to change that setting, and others. 

Before the Integration Retry job can run the first time, you "schedule" it. Scheduling the job just means clicking the Start button next to the Schedule Integration Retry Job option on the admin panel. 

Note: For Offline and Online status to work, your org must be running in PlatformEvents mode.

26) Explain cancellation of In-flight orders in vlocity order management?

Order that is in the process of fulfillment is referred to as an In-flight order.

You can cancel a submitted order if it has not passed the point of no return (PONR). A task in an executing orchestration plan reaches PONR when it advances to any of the following states: Completed, Running, Failed, Fatally Failed.

Once order is submitted and accepted by order management for order fulfillment. If you want to cancel the whole order or a few order line items within the order, you can send a cancellation request to the order management system if the order or order items have not passed PONR. 

Supplemental orders are automatically generated by CPQ after an order cancel request has been issued and validation is completed by order management. Supplemental orders are automatically decomposed as well.

Cancellation is at the order-level or order-item depending on what is selected on the order and PONR configurations.

Original Order Status:

The original order transitions from Cancel Requested to Superseded.

Supplemental Order Status:

If all goes well during cancellation process the state transitions from Cancel In Progress to Cancelled.

Initial state during order cancellation:

                                 Status(Salesforce)      Vlocity Order Status

Original Order                Draft                     Cancelled Requested

Supplemental Order        Draft                     Ready to Submit


If everything goes well:

                                    Status(Salesforce)   Vlocity Order Status   Fulfilment Status

Original Order               Draft                        Superseded                   Superseded 

Supplemental Order      Activated                 Cancelled                      Activated                 

 If there is some error in cancellation process:

                                      Status(Salesforce)   Vlocity Order Status

Original Order               Draft                        In Progress

Supplemental Order      Activated                 Rejected


27) Explain amendments of In-flight orders in  order management?

Using the amend feature, you can add, modify, or delete the cart line items or you can also modify, add, or cancel a promotion and discount that applies to a line item after the order is submitted. It helps you modify your order before order management completes its fulfillment.

You can amend a submitted order if it has not passed the point of no return (PONR).
A task in an executing orchestration plan reaches PONR when it advances to any of the following states: Completed, Running, Failed, Fatally Failed.

After you submit an amended order, The supplemental order status changes to In-Progress and the original order is superseded.

28) Explain the difference between Amendment plans and Rollback plans?

An amendment plan is an orchestration plan that is generated when an order item is amended. A rollback plan is the orchestration plan used for canceling orders or order items.

29) What are supplemental orders?

As soon as we clicks the Amend or Cancel button a supplemental order is created. This order looks like the original order, but can be amended by the operator. Once submitted, the supplemental order supersedes the original order.

30) What are frozen orders?

Order Management freezes the original order as soon as the Amend or Cancel button is clicked, except that running items are allowed to finish. If you'd prefer that running items become frozen as well, you can do so by marking the checkbox "Smart Freeeze" on item definition to true.

31) Explain the workflow for amending the order?

As soon as we clicks the Amend button on an order, the following things happen:

1) Order Management freezes the original order. By default, items that are running continue to run. If you'd prefer that running items become frozen as well, you can do so by marking the checkbox "Smart Freeeze" on item definition to true.

2) A supplemental order is created, and you can amends it as required, then submits it.

3) Order Management compares the supplemental order to the original order. If any proposed amended item has already reached PONR, then the amendment is rejected.

4) If the proposed amended items are accepted, then a new decomposition is created, with supplemental actions compensating for the original actions.

5) The orchestration plan is updated with necessary amendments.

6) The fulfillment status of the original order is marked Superseded.

32) What is the relation between original order orchestration plan and supplemental order orchestration plan?

Order Management associates the original orchestration plan with the supplemental order, updates the orchestration plan, and then follows the workflow in the rollback or amendment plans.

33) How the decomposition for supplemental order works?

As soon as we clicks the Amend button or Cancel order button on an order Vlocity creates a new supplemental order and decompose it.

Order management compares the new decomposition plan to that of the original order. A difference between the two decomposition plans indicates the need for a supplemental action. When there are changes, OM creates a supplemental action to supersede the original one.

For example, let's say that a customer orders a Mobile phone and order is decomposed and orchestration is in progress. Let say the customer cancels the order, in this case order management maintains the original "Add" action, but adds a supplemental "Cancel" action to supersede the original action.
    
34) Explain how the decomposition works during amendment?

Figure 1 shows the Mobile Phone product which has several attributes (Colour, Delievery, Back Cover and so on), two of which have conditions. The Memory Card product also has an attribute with a condition.

                                                            FIGURE 1

Figure 2 shows the original order. 

The customer has ordered Mobile Phone and Memory Card, but has not ordered the Back Cover. Let's assume the scope is set to Account on "Technical Product Mobile", thus two order items result in a single, combined fulfillment request.

                                                                   FIGURE 2

Now, we will raise an amend order to add Back Cover. This supplemental order will have the following effects:
  1. A new downstream fulfillment request is added for Back Cover with vlocity action as Add.
  2. The fulfillment request Technical Product Mobile gets a supplemental action of Amend because it's the parent of the new fulfillment request.
  3. The Mobile Phone order item has changed, so gets a supplemental action of Amend.
  4. The memory card order item is carried forward as is, so has supplemental action of No Change.

                                                                FIGURE 3