• Ashish Nag K
  • NEWBIE
  • 10 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 4
    Replies
Test Class for this code not able to cover 75 percentage also 

 @AuraEnabled
    public static List<ToDoList__c> DynamicApprovalProcess(String todoString, Boolean approve){
        if(String.isNotBlank(todoString)){
            List<ToDoList__c> toDoList = (List<ToDoList__c>)System.JSON.deserialize(todoString, List<ToDoList__c>.class);
            if(toDoList!=NULL && toDoList.size()>0){
                Set<Id> recordIdSet = new Set<Id>();
                Map<String, ToDoList__c> todoMap = new Map<String, ToDoList__c>();
                for(ToDoList__c todo: toDoList){
                    recordIdSet.add(todo.Record_Id__c);
                    todoMap.put(todo.Record_Id__c, todo);
                }
                
                if(recordIdSet.size()>0){
                    list<Approval.ProcessWorkitemRequest> prWkItemList = new list<Approval.ProcessWorkitemRequest>();
                    map<Id, ProcessInstance> processInsMap = new map<Id, ProcessInstance>([Select ID, Status From ProcessInstance Where TargetObjectID IN:recordIdSet AND Status = 'Pending']);
                    if(processInsMap!=NULL && processInsMap.size()>0){
                        for(ProcessInstanceWorkitem workitem : [select Id,OriginalActorId from ProcessInstanceWorkitem where ProcessInstanceId IN:processInsMap.keySet()]){
                            Approval.ProcessWorkitemRequest prWkItem = new Approval.ProcessWorkitemRequest();
                            prWkItem.setWorkItemID(workitem.id);
                            if(approve)
                               prWkItem.setAction('Approve');
                            else
                               prWkItem.setAction('Reject');
                            
                            prWkItemList.add(prWkItem);                            
                        }
                        
                        if(prWkItemList.size()>0){
                           list<Approval.ProcessResult> appResultList = Approval.process(prWkItemList);
                           List<ToDoList__c> todoupdateList= new List<ToDoList__c>();
                            if(appResultList!=NULL && appResultList.size()>0){
                                for(Approval.ProcessResult result: appResultList){
                                    if(result.isSuccess() && todoMap.size()>0 && todoMap.containsKey(result.entityid)){
                                        ToDoList__c todoupdate = new ToDoList__c();
                                        todoupdate.Id = todoMap.get(result.entityid).Id;
                                        todoupdate.Status__c = 'Closed';
                                        todoupdateList.add(todoupdate);
                                    }else if(!result.isSuccess() && todoMap.size()>0 && todoMap.containsKey(result.entityid)){
                                        ToDoList__c todoupdate = new ToDoList__c();
                                        todoupdate.Id = todoMap.get(result.entityid).Id;
                                        if(String.isNotBlank(todoMap.get(result.entityid).Body__c) && result.errors.size()>0)
                                          todoupdate.Body__c = todoMap.get(result.entityid).Body__c+' Error in Approval Process: '+result.errors[0];
                                        else if(result.errors.size()>0 && !String.isNotBlank(todoMap.get(result.entityid).Body__c))
                                          todoupdate.Body__c = 'Error in Approval Process: '+result.errors[0];
                                        todoupdateList.add(todoupdate);
                                    }
                                }
                                
                                if(todoupdateList.size()>0)
                                    database.update(todoupdateList, false);
                                
                            }
                        }
                    }
                }
            }
        }
        return EmployeeDashboardController.fetchToDoListMethod();
    }
}
Can we input the arabic language from right to left for any record in objects in lightning experience (In salesforce classic its working but in lightning Experience is there any option ?)
For  Superbadge
Lightning Experience Specialist got stuck in Automate the creation of fulfillments:-


Challenge Not yet complete... here's what's wrong: 
There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_EXECUTE_FLOW_TRIGGER, We can't save this record because the “Fulfillment Creation” process failed. Give your Salesforce admin these details. This error occurred when the flow tried to create records: FIELD_INTEGRITY_EXCEPTION: Related To ID: id value of incorrect type: 0036F00002qtGtxQAE. You can look up ExceptionCode values in the SOAP API Developer Guide. Error ID: 1593817222-284171 (2129359818): []

Got this email :-


Error element myRule_1_A4 (FlowRecordCreate).
This error occurred when the flow tried to create records: FIELD_INTEGRITY_EXCEPTION: Related To ID: id value of incorrect type: 0036F00002qtGtxQAE. You can look up ExceptionCode values in the SOAP API Developer Guide.

Flow Details
Flow Name: Fulfillment_Creation
Type: Record Change Process
Version: 10
Status: Active
Org: Absyz (00D6F000001GbuR)

Flow Interview Details
Interview Label: Fulfillment_Creation-10_InterviewLabel
Current User: Ashish Nag K (0056F00000BvQtt)
Start time: 11/27/2018 5:20 AM
Duration: 0 seconds

How the Interview Started
Ashish Nag K (0056F00000BvQtt) started the flow interview.
Some of this flow's variables were set when the interview started.
myVariable_old = null
myVariable_current = OpportunityLineItem (00k6F0000142A4rQAE)

ASSIGNMENT: myVariable_waitStartTimeAssignment
{!myVariable_waitStartTimeVariable} Equals {!$Flow.CurrentDateTime}
Result
{!myVariable_waitStartTimeVariable} = "11/27/2018 5:20 AM"

DECISION: myPreWaitDecision_myWait_myRule_1
Executed this outcome: myPreWaitRule_myWait_myRule_1
Outcome conditions: 
1. {!myVariable_current.Opportunity.StageName} (New) Does not equal Cancelled
2. {!myVariable_current.Fulfillment_Created__c} (false) Equals false
Logic: All conditions must be true (AND)

DECISION: myDecision
Executed this outcome: myRule_1
Outcome conditions: 
1. {!myVariable_current.Opportunity.StageName} (New) Does not equal Cancelled
2. {!myVariable_current.Fulfillment_Created__c} (false) Equals false
Logic: All conditions must be true (AND)

RECORD CREATE: myRule_1_A1
Create one Fulfillment__c record where:
AdventurePackageId__c = {!myVariable_current.Id} (00k6F0000142A4rQAE)
Adventure_Package_Cost__c = {!myVariable_current.TotalPrice} (1)
Adventure__c = {!myVariable_current.Product2.Id} (01t6F00000ABhpEQAT)
Expedition_Leader__c = {!myVariable_current.Product2.Expedition_Leader__c} (null)
Explorer__c = {!myVariable_current.Explorer__c} (0036F00002qtGtxQAE)
Name = {!formula_2_myRule_1_A1_5299346317} (Lemons00k6F0000142A4rQAE)
Opportunity__c = {!myVariable_current.OpportunityId} (0066F00000x64XSQAY)
Schedule_Date__c = {!myVariable_current.ServiceDate} (January 1, 2050)
Status__c = New
Result
A record is ready to be created when the next Screen or Wait element is executed or when the interview finishes.

RECORD UPDATE: myRule_1_A2
Find all OpportunityLineItem records where:
Id Equals {!myVariable_current.Id} (00k6F0000142A4rQAE)
Update the records’ field values.
Fulfillment_Created__c = true
Result
All records that meet the filter criteria are ready to be updated when the next Screen or Wait element is executed or when the interview finishes.

RECORD UPDATE: myRule_1_A3
Find all Opportunity records where:
Id Equals {!myVariable_current.OpportunityId} (0066F00000x64XSQAY)
Update the records’ field values.
Needs_Insurance__c = {!myVariable_current.Product2.Needs_Insurance__c} (false)
Needs_Waiver__c = {!myVariable_current.Product2.Needs_Waiver__c} (false)
Result
All records that meet the filter criteria are ready to be updated when the next Screen or Wait element is executed or when the interview finishes.

RECORD CREATE: myRule_1_A4
Create one Task record where:
IsReminderSet = true
OwnerId = {!myVariable_current.Opportunity.Owner.Id} (0056F00000BvQttQAF)
Priority = Normal
Status = Not Started
Subject = Hello
WhatId = {!myVariable_current.Explorer__c} (0036F00002qtGtxQAE)
Result
Failed to create record.


 
Challenge Not yet complete... here's what's wrong: 
The Sales Operation dashboard isn't configured according to the requirements. 1. The Bar chart, Gauge and Donut must measure Sum of Amount and must be named correctly. 2. The filter must be named Stage value. 3. The dashboard should run as the logged in user.


Im attaching the images User-added image


User-added imageUser-added image


Still im not able to rectifiy what is wrong

Challenge Not yet complete... here's what's wrong: 
The Sales Operation dashboard isn't configured according to the requirements. 1. The Bar chart, Gauge and Donut must measure Sum of Amount and must be named correctly. 2. The filter must be named Stage value. 3. The dashboard should run as the logged in user.
Challenge Not yet complete... here's what's wrong: 
There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: FEOIOYZI
Can we input the arabic language from right to left for any record in objects in lightning experience (In salesforce classic its working but in lightning Experience is there any option ?)

Challenge Not yet complete... here's what's wrong: 
The Sales Operation dashboard isn't configured according to the requirements. 1. The Bar chart, Gauge and Donut must measure Sum of Amount and must be named correctly. 2. The filter must be named Stage value. 3. The dashboard should run as the logged in user.
Challenge Not yet complete... here's what's wrong: 
There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: FEOIOYZI