• Shyam Nair
  • NEWBIE
  • 4 Points
  • Member since 2016
  • Technica Architect
  • Resideo


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 9
    Replies
Hi Trailblazers,
 
I am in the process of implementing voting capability for guest users on articles in communities. Have any one implemented this solution before?
 
My idea was to create a separate object to capture user feedback, but unfortunately, we can't link this to Article Types as there is no way to create Lookup or Master-detail relation on Article Types.
 
Please help.
Hi,

I am working on Trailhead project Build an Account Reassignment Wizard and when I am trying to clear Unit 3, I am getting below error. This is a new Dev Org I am working on. Please help.

User-added image

Hi,

I am trying to update orderTrigger on challenge 2, and  I am getting below error:
User-added image

Please find my trigger and helper class below. Any help would be highly appreciated.

orderTrigger:

/**
 * @name orderTrigger
 * @description
**/
trigger orderTrigger on Order (after update) {
    public Set<Id> orderIds = new Set<Id>();
    if(Trigger.new != null){
    	orderIds = OrderHelper.AfterUpdate(Trigger.new, Trigger.old);    
    }
    
    OrderHelper.RollUpOrderItems(orderIds);
    
}

OrderHelper:
public with sharing class OrderHelper {

    /**
     * @name AfterUpdate
     * @description 
     * @param List<Order> newList
     * @param List<Order> oldList
     * @return void
    **/
    public static Set<Id> AfterUpdate(List<Order> newList, List<Order> oldList){
        Set<Id> orderIds = new Set<Id>();
        for ( Integer i=0; i<newList.size(); i++ ){
            if ( newList[i].Status == 'Activate' && oldList[i].Status == 'Draft' ){
                orderIds.add(newList[i].Id);
            }
        }
        return orderIds;
    }

    /**
     * @name RollUpOrderItems
     * @description Given a set of Activated Order ids, query the child Order Items and related Products to calculate Inventory levels
     * @param Set<Id> activatedOrderIds
     * @return void
    **/
    public static void RollUpOrderItems(Set<Id> activatedOrderIds){
        Map<Id, Product2> productMap;
        Set<Id> product2Ids = new Set<Id>();
        List<OrderItem> orderItems = [SELECT Id, Quantity, Product2Id FROM OrderItem WHERE OrderId IN:activatedOrderIds];
        for(OrderItem item :orderItems){
            product2Ids.add(item.Product2Id);
        }
        productMap = new Map<Id, Product2>([SELECT Id, Quantity_Ordered__c FROM Product2 WHERE Id IN :product2Ids]);
        for(OrderItem item :orderItems) {
            if(productMap.containsKey(item.Product2Id)) {
                productMap.get(item.product2Id).Quantity_Ordered__c -= item.Quantity;
            }
        }
        update productMap.values();
    }

}
Hi,

While attempting trailhead App Development with Salesforce DX, I am trying to create a project using SFDX command as shown below:
User-added image

But I am getting a message which says the command is not available. Please help.

Regards,
Shyam Nair
Hello everyone,

We have a community build on Lightning Experience. Now when an admin tries to login to community through a contact, we are restricting certain functionalities on basis on RSID cookie value. 

Now to get RSID cookie value we are using document.cookie property in lightning component. This is working in IE but in Chrome its showing as undefined. 

This is happening due to the recent Locker Service changes Salesforce. And the above idea to check whether admin has logged in as a contact was given by developers from Salesforce itself.

Has anyone experienced the same issue and has a solution for the same? Please let me know. 

Thank you.
Hi, I am unable to complete the module Adding Business Logic, where I am getting the below error message. Please help.
Adding Business Logic Error Message
Hi all,

I use apex trigger to auto complete a milestone "Response Time", it works but I have to create a test apex class to import it in production and the code coverage is only 70%.

Can you help me?

My test class :
@isTest
private class MilestoneTest {

static testMethod void TestCompleteMilestoneCase(){

List<Account> acts = new List<Account>();
Account myAcc = new Account(Name='TestAct', phone='1001231234');
acts.add(myAcc);

Account busAcc = new Account(Name = 'TestForMS', phone='4567890999');
acts.add(busAcc);
insert acts;
Contact cont = new Contact(FirstName = 'Test', LastName = 'LastName', phone='4567890999', accountid = busAcc.id);
insert(cont);

Contact oContact = [select id from Contact limit 1];
        String contactId;
        if (oContact != null)
          contactId = oContact.Id;

Asset ast = new Asset(Name='support platinum', 
                      AccountId=busAcc.Id, 
                      Start_date__c = date.today().addDays(-5), 
                      End_date__c = date.today().addDays(5));
insert ast;

    
ast = [SELECT Id, Name, Active__c, Start_date__c, End_date__c, AccountId FROM Asset WHERE Id=:ast.Id];

    
String astId;
if (astId != null)
astId = ast.Id;    
    
Entitlement entl = new Entitlement(Name='First Response - SUPPORT PLATINUM PLAN - TestForMS', AccountId=busAcc.Id, AssetId = astId, EndDate= date.today().addDays(5), StartDate= date.today());
insert entl;

 String entlId;
if (entl != null)
entlId = entl.Id; 
    

List<Case> cases = new List<Case>{};
if (entlId != null){
	Case c = new Case(Subject = 'Test Case with Entitlement ', 
	EntitlementId = entlId, ContactId = contactId, Description = 'test', Departement__c = 'Centreon', AssetId = astId, Priority = 'Blocking');
	cases.add(c);
}
if (cases.isEmpty()==false){
	insert cases;
    
	List<Id> caseIds = new List<Id>();
	for (Case cL : cases){
		caseIds.add(cL.Id);
	}
	milestoneUtils.completeMilestone(caseIds, 'First Response', System.now());
}
}

}

My apex class MilestoneUtils:
public class MilestoneUtils {
    public static void completeMilestone(List<Id> caseIds, 
            String milestoneName, DateTime complDate) {  
    List<CaseMilestone> cmsToUpdate = [select Id, completionDate
            from CaseMilestone cm
            where caseId in :caseIds and cm.MilestoneType.Name=:milestoneName 
            and completionDate = null limit 1];
    if (cmsToUpdate.isEmpty() == false){
        for (CaseMilestone cm : cmsToUpdate){
            cm.completionDate = complDate;
            }
        update cmsToUpdate;
        }
	else{
		List<CaseMilestone> cmsTest = [select Id, completionDate
            from CaseMilestone cm
            where caseId in :caseIds limit 1];
        update cmsTest;
		}
    }
}

Problem is cmsToUpdate is empty because Case Milestione isn't created. 
I don't understand why
Hi,

I am working on Trailhead project Build an Account Reassignment Wizard and when I am trying to clear Unit 3, I am getting below error. This is a new Dev Org I am working on. Please help.

User-added image

Hi,

I am trying to update orderTrigger on challenge 2, and  I am getting below error:
User-added image

Please find my trigger and helper class below. Any help would be highly appreciated.

orderTrigger:

/**
 * @name orderTrigger
 * @description
**/
trigger orderTrigger on Order (after update) {
    public Set<Id> orderIds = new Set<Id>();
    if(Trigger.new != null){
    	orderIds = OrderHelper.AfterUpdate(Trigger.new, Trigger.old);    
    }
    
    OrderHelper.RollUpOrderItems(orderIds);
    
}

OrderHelper:
public with sharing class OrderHelper {

    /**
     * @name AfterUpdate
     * @description 
     * @param List<Order> newList
     * @param List<Order> oldList
     * @return void
    **/
    public static Set<Id> AfterUpdate(List<Order> newList, List<Order> oldList){
        Set<Id> orderIds = new Set<Id>();
        for ( Integer i=0; i<newList.size(); i++ ){
            if ( newList[i].Status == 'Activate' && oldList[i].Status == 'Draft' ){
                orderIds.add(newList[i].Id);
            }
        }
        return orderIds;
    }

    /**
     * @name RollUpOrderItems
     * @description Given a set of Activated Order ids, query the child Order Items and related Products to calculate Inventory levels
     * @param Set<Id> activatedOrderIds
     * @return void
    **/
    public static void RollUpOrderItems(Set<Id> activatedOrderIds){
        Map<Id, Product2> productMap;
        Set<Id> product2Ids = new Set<Id>();
        List<OrderItem> orderItems = [SELECT Id, Quantity, Product2Id FROM OrderItem WHERE OrderId IN:activatedOrderIds];
        for(OrderItem item :orderItems){
            product2Ids.add(item.Product2Id);
        }
        productMap = new Map<Id, Product2>([SELECT Id, Quantity_Ordered__c FROM Product2 WHERE Id IN :product2Ids]);
        for(OrderItem item :orderItems) {
            if(productMap.containsKey(item.Product2Id)) {
                productMap.get(item.product2Id).Quantity_Ordered__c -= item.Quantity;
            }
        }
        update productMap.values();
    }

}
Hello everyone,

We have a community build on Lightning Experience. Now when an admin tries to login to community through a contact, we are restricting certain functionalities on basis on RSID cookie value. 

Now to get RSID cookie value we are using document.cookie property in lightning component. This is working in IE but in Chrome its showing as undefined. 

This is happening due to the recent Locker Service changes Salesforce. And the above idea to check whether admin has logged in as a contact was given by developers from Salesforce itself.

Has anyone experienced the same issue and has a solution for the same? Please let me know. 

Thank you.
Hi, I am unable to complete the module Adding Business Logic, where I am getting the below error message. Please help.
Adding Business Logic Error Message
Has anyone completed this trail? I am stomped on challenge number 3, regarding created the process for fulfillment. Any pointers or guidance would be appreciated.
 
Hello,

I'm having trouble checking the challenge, I've checked other discussions and I've done exactly what others have done to pass but everytime I click check challange it gives me this error message:

Looks like something went wrong, please try again later.

I've logged out of both Developer Edition and Trailhead acc, used another new Developer Edition to redo the challenge and it gives me the same message.