• kamala swarnalatha
  • NEWBIE
  • 215 Points
  • Member since 2018

  • Chatter
    Feed
  • 7
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 110
    Replies

Apex class
global class ModelLevel{
global static String getfunction(){
      String fpmsg;
      User usr = [select Id,Name,accountid,c_User_Country__c From User where Id = :UserInfo.getUserId() LIMIT 1];
 List<ObjectA__c> rcmsg = new List<ObjectA__c>();
      rcmsg  =[SELECT body__c from ObjectA__c where Type__C='homemessage' AND Country__c=:usr.c_User_Country__c  LIMIT 1];
           if(rcmsg!=null && !rcmsg.isEmpty() ){
               if(rcmsg[0].body__c!=null && rcmsg[0].body__c!=''){
                   fpmsg =rcmsg[0].body__c;
                    }
               else{
                   rcmsg =[SELECT id,name,Title__c,body__c from ObjectA__c where Type__C='homemessage' AND Country__c ='Global' LIMIT 1];
                                                fpmsg= rcmsg[0].body__c;
     }
          }
               else{
               rcmsg =[SELECT id,name,Title__c,body__c from ObjectA__c where Type__C='homemessage' AND Country__c ='Global' LIMIT 1];
                              fpmsg= rcmsg[0].body__c;
      }
      return fpmsg.unescapeHtml4();  
    }
########################################################
Test class

@isTest
Global class Modelleveltest
{

 private static testMethod void test_getfunction (){
        Account acc = CreateTestDataUtility.createAccount();
        Contact con = CreateTestDataUtility.createContact(acc);
        Contact con1 = CreateTestDataUtility.createContact(acc);
                Profile p = [SELECT Id FROM Profile WHERE Name = 'Sales User' LIMIT 1];
                 User localUser= new User
                profileId = p.id,
                username = 'Test33@test.com.test',
                email = 'Test33@test.com.test',
                emailencodingkey = 'UTF-8',
                localesidkey = 'en_US',
                languagelocalekey = 'en_US',
                timezonesidkey='America/Los_Angeles',
                alias='test22',
                lastname='Testing22',
                contactId=con.id,
                country =  'Turkey',
                Geographic_Region__c='Europe',                  
                c_User_Country__c = 'Turkey',
                User_Region__c = 'Turkey'
            );
        insert localUser;
       
        User TestUser= new User(
                          
                profileId = p.id,
                username = '23@test.com.test',
                email = '23@test.com.test',
                emailencodingkey = 'UTF-8',
                localesidkey = 'en_US',
                languagelocalekey = 'en_US',
                timezonesidkey='America/Los_Angeles',
                alias='newtest3',
                lastname='Testing3',
                contactId=con1.id,
                country = 'France',
                Geographic_Region__c='Europe',                   
                c_User_Country__c = 'France',
                User_Region__c = 'France'
            );
               insert TestUser;
List< ObjectA__c > Newval = new List< ObjectA__c >();
ObjectA__c usr1 = new ObjectA__c (Name='Content11',Country__c='Turkey',Customer_Type__c='Distributor',Title__c='Test Content',Body__c='Testconentnew',Type__c=' homemessage ');
Newval.add(usr1);
ObjectA__c usr2 = new ObjectA__c (Name='Content22',Country__c='Global',Customer_Type__c='Distributor',Title__c='Test Content test',Body__c='TestContentnewmsg',Type__c=' homemessage ');
Newval.add(usr2);
insert Newval;
        Test.StartTest();
        System.runAs(localUser){
  ModelLevel. getfunction ();
        }
                System.runAs(TestUser){
  ModelLevel. getfunction ();
                }
            Test.StopTest();
        }
}




      
 
I have two users A and B with same Profile, User A should see only his Account records and user B should see entire Organisation records.
How can we achieve this?
Im trying to update a custom field called related_contact__c on opportunity, that will populate with the id of a related contact. This will auto-populate when a contact is related to the opportunity but is not the contact lookup field
Hi all,
I have created 2 accounts: nihar and head 
And I have created Related 3 opportunities records: opp1 , opp2 , opp3
Under nihar account opp1
under head account opp2 and opp3
My Task is to show closed date or due date of opportunities under accounts if one opportunities 75 days from created date and 2 or more 180+
Example: nihar account -- opp1 (due date should be 75+ from created date)
head account --- opp2,opp3(due date should be 180+ from created date)

Thanks in Advance!!!
  • May 02, 2018
  • Like
  • 0
Trying to create a validation where Equipment Feedback is selected in the VOC Description picklist field, and then make the following picklist fields required (with any value). 

AND(ISPickval( VOC_Description__c  ,'Equipment Feedback'),
(Ispickval(Brand__c ,"")
((Ispickval(Condition__c,"")
(Ispickval(Model__c,"")
(Ispickval(Product_Family__c,"")
(Ispickval(Brand__c,"")
(Ispickval(Product_Type__c,"")))))))
Hi,
I have a requirement, where sales guyz are in Asia, North America, South America and Europe. Cutomer wants to have completely different sales process and different page layouts ? How can I acheive this requirement please ?
  • April 12, 2018
  • Like
  • 0
Hi, 

  I want to create a validation in account on BillingState this should be mandatory when BillingCountry = United States or US or USA. Please suggest me a logic. 

Thanks
Sudhir
  • March 20, 2018
  • Like
  • 0
Hi,

Hope someone helps here!

I have written the code to get a count of opportunities on the contract. It works fine when I have add the opportunity under the contract. But it doesn't work on adding the contract through the contract lookup field on an opportunity.

This is the Trigger and Apex class I have written.

Apex Trigger:

trigger OpportunityTrigger on Opportunity (After Insert,After Update,After Delete,After undelete)
{
OppTriggerHandler handler=new OppTriggerHandler();
if(Trigger.isAfter && Trigger.isInsert)
{
handler.afterInsert(Trigger.newMap);
}
if(Trigger.isAfter && Trigger.isDelete)
{
handler.afterdelete(Trigger.oldMap);
}
if(Trigger.isAfter && Trigger.isUndelete)
{
handler.afterUndelete(Trigger.newMap);
}
if(Trigger.isAfter && Trigger.isUpdate)
{
handler.afterUpdate(Trigger.oldMap);
}
}


Apex class:

public class OppTriggerHandler
{
//After insert
public void afterInsert(Map<Id,Opportunity> newMap)
{
//contracts to update
Set<Id> contrIds=new Set<Id>();
//Iterate to get contract Ids
for(Opportunity opp:newMap.Values())
{
//check opportunity have contract Id
if(opp.ContractId!=null)
{
//Adding contract Id to the Set<Id>
contrIds.add(opp.ContractId);
}
}
//call update contract actions
if(contrIds.size()>0)
{
THIS.updateContracts(contrIds);
THIS.updateContracts2(contrIds);
}
}
//After update
public void afterUpdate(Map<Id,Opportunity> oldMap)
{
//contracts to update
Set<Id> contrIds=new Set<Id>();
//Iterate to get contract Ids
for(Opportunity opp:oldMap.Values())
{
//check opportunity have contract Id
if(opp.ContractId!=null)
{
//Adding contract Id to the Set<Id>
contrIds.add(opp.ContractId);
}
}
//call update contract actions
if(contrIds.size()>0)
{
THIS.updateContracts(contrIds);
THIS.updateContracts2(contrIds);
}
}
//After delete
public void afterdelete(Map<Id,Opportunity> oldMap)
{
//contracts to update
Set<Id> contrIds=new Set<Id>();
//Iterate to get contract Ids
for(Opportunity opp:oldMap.Values())
{
//check opportunity have contract Id
if(opp.ContractId!=null)
{
//Adding contract Id to the Set<Id>
contrIds.add(opp.ContractId);
}
}
//call update contract actions
if(contrIds.size()>0)
{
THIS.updateContracts(contrIds);
THIS.updateContracts2(contrIds);
}
}
//After Undelete
public void afterUndelete(Map<Id,Opportunity> newMap)
{
//contracts to update
Set<Id> contrIds=new Set<Id>();
//Iterate to get contract Ids
for(Opportunity opp:newMap.Values())
{
//check opportunity have contract Id
if(opp.ContractId!=null)
{
//Adding contract Id to the Set<Id>
contrIds.add(opp.ContractId);
}
}
//call update contract actions
if(contrIds.size()>0)
{
THIS.updateContracts(contrIds);
THIS.updateContracts2(contrIds);
}
}
//contracts to be updated
private void updateContracts(Set<Id> contrIds)
{
Decimal totalValue = 0;
//getting contract records based on Contract Ids
List<Contract> contrlist=[SELECT Id,Opp_Count__c,Opp_Amount__c,(select Id FROM Opportunities) FROM Contract WHERE Id IN:contrIds];
//Iterating Contracts to update Total opportunities from child on parent query
for(Contract con : contrlist)
{
con.Opp_count__c=con.opportunities.size();
}
if(contrlist.size()>0)
{
update contrlist;
}
}
private void updateContracts2(Set<Id> contrIds)
{
List<Opportunity> oppforContracts = [SELECT Id ,ContractId, Amount FROM Opportunity WHERE ContractId IN :contrIds];

List<Contract> contrsToUpdate = [SELECT Id, Opp_Amount__c FROM Contract WHERE Id IN :contrIds];

for (Contract contr : contrsToUpdate) {
Set<Id> oppIds = new Set<Id>();
Decimal totalValue = 0;
for (Opportunity opp1 : oppforContracts) {
    if (opp1.ContractId == contr.Id && opp1.Amount != NULL) {
        totalValue += opp1.Amount; 
    }
}
contr.Opp_Amount__c = totalValue;
}
if(contrsToUpdate.size() > 0) {
    update contrsToUpdate;
}
}
}

Thanks in Advance!
Kamala Swarnalatha
Hi,
Hope everyone is doing well.

I am trying to get the count and the related child details in the VF component then call this component into VF Ema template so that i can use the email template in workflow rule.

But, when i try to save the VF component i am getting this error. Can someone please help me.?

Apex Class: 
Public class AccountContactEngCount2{
public Id campaignIdSet {get;set;}
public List<Campaign> getAccountContactEngCount_Method(Set<Id> campaignIdSet){
Map<Id,Set<Id>> campIdVsConIdEngSet= new Map<Id,Set<Id>>();
Set<Id> contIdEngSet= new Set<Id>();

Map<Id,Set<Id>> campIdVsConIdEngSet_Month= new Map<Id,Set<Id>>();
Set<Id> contIdEngSet_Month= new Set<Id>();

Map<Id,Set<Id>> campIdVsConIdEngSet_Week= new Map<Id,Set<Id>>();
Set<Id> contIdEngSet_Week= new Set<Id>();

Map<Id,Set<Id>> campIdVsAccIdSet= new Map<Id,Set<Id>>();
Set<Id> accIdSet= new Set<Id>();

Map<Id,Set<Id>> campIdVsAccIdSet_Month= new Map<Id,Set<Id>>();
Set<Id> accIdSet_Month= new Set<Id>();

Map<Id,Set<Id>> campIdVsAccIdSet_Week= new Map<Id,Set<Id>>();
Set<Id> accIdSet_Week= new Set<Id>();

Date myTodayDate= Date.today();
        Date Week=myTodayDate.toStartofWeek();
        Integer Month = (myTodayDate).Month();//For calculating the current month 
        
List<Engagement__c> EnagementList = [Select ID,Campaign__c,Contact_Name__c,Contact_Name__r.AccountId,Engagement_Date__c From Engagement__c Where Campaign__c in : campaignIdSet];
        For(Engagement__c engObj : EnagementList)
        {
            if(engObj.Contact_Name__r.AccountId!=null){
                if(engObj.Engagement_Date__c!=null)
                {
                    if((engObj.Engagement_Date__c).Month()==Month){
                        if(!campIdVsAccIdSet_Month.keySet().contains(engObj.Campaign__c))
                        {
                            accIdSet_Month= new Set<Id>();
                            accIdSet_Month.add(engObj.Contact_Name__r.AccountId);
                            campIdVsAccIdSet_Month.put(engObj.Campaign__c,accIdSet_Month);
                        }
                        else
                        {
                            campIdVsAccIdSet_Month.get(engObj.Campaign__c).add(engObj.Contact_Name__r.AccountId);
                        }
                    }
                    if((engObj.Engagement_Date__c).toStartofWeek()==Week){
                        if(!campIdVsAccIdSet_Week.keySet().contains(engObj.Campaign__c))
                        {
                            accIdSet_Week= new Set<Id>();
                            accIdSet_Week.add(engObj.Contact_Name__r.AccountId);
                            campIdVsAccIdSet_Week.put(engObj.Campaign__c,accIdSet_Week);
                        }
                        else
                        {
                            campIdVsAccIdSet_Week.get(engObj.Campaign__c).add(engObj.Contact_Name__r.AccountId);
                        }
                    }
                }
                if(!campIdVsAccIdSet.keySet().contains(engObj.Campaign__c))
                {
                    accIdSet= new Set<Id>();
                    accIdSet.add(engObj.Contact_Name__r.AccountId);
                    campIdVsAccIdSet.put(engObj.Campaign__c,accIdSet);
                }
                else
                {
                    campIdVsAccIdSet.get(engObj.Campaign__c).add(engObj.Contact_Name__r.AccountId);
                }
            }
            if(engObj.Contact_Name__c!=null){
                //--------------
                if(engObj.Engagement_Date__c!=null)
                {
                    if((engObj.Engagement_Date__c).Month()==Month){
                        if(!campIdVsConIdEngSet_Month.keySet().contains(engObj.Campaign__c))
                        {
                            contIdEngSet_Month= new Set<Id>();
                            contIdEngSet_Month.add(engObj.Contact_Name__c);
                            campIdVsConIdEngSet_Month.put(engObj.Campaign__c,contIdEngSet_Month);
                        }
                        else
                        {
                            campIdVsConIdEngSet_Month.get(engObj.Campaign__c).add(engObj.Contact_Name__c);
                        }
                    }
                    if((engObj.Engagement_Date__c).toStartofWeek()==Week){
                        if(!campIdVsConIdEngSet_Week.keySet().contains(engObj.Campaign__c))
                        {
                            contIdEngSet_Week= new Set<Id>();
                            contIdEngSet_Week.add(engObj.Contact_Name__c);
                            campIdVsConIdEngSet_Week.put(engObj.Campaign__c,contIdEngSet_Week);
                        }
                        else
                        {
                            campIdVsConIdEngSet_Week.get(engObj.Campaign__c).add(engObj.Contact_Name__c);
                        }
                    }
                }
                //------------
                if(!campIdVsConIdEngSet.keySet().contains(engObj.Campaign__c))
                {
                    contIdEngSet= new Set<Id>();
                    contIdEngSet.add(engObj.Contact_Name__c);
                    campIdVsConIdEngSet.put(engObj.Campaign__c,contIdEngSet);
                }
                else
                {
                    campIdVsConIdEngSet.get(engObj.Campaign__c).add(engObj.Contact_Name__c);
                }
            }
        }


List<Meeting_Tracker__c> meetingList = [Select ID,Campaign_lookup__c,Contact__c,Contact__r.AccountId,Booked_Date__c From Meeting_Tracker__c Where Campaign_lookup__c in : campaignIdSet]; 
        For(Meeting_Tracker__c meetObj : meetingList)
        {
            if(meetObj.Contact__r.AccountId!=null)
            {
                if(meetObj.Booked_Date__c!=null)
                {
                    if((meetObj.Booked_Date__c).Month()==Month){
                        if(!campIdVsAccIdSet_Month.keySet().contains(meetObj.Campaign_lookup__c))
                        {
                            accIdSet_Month= new Set<Id>();
                            accIdSet_Month.add(meetObj.Contact__r.AccountId);
                            campIdVsAccIdSet_Month.put(meetObj.Campaign_lookup__c,accIdSet_Month);
                        }
                        else
                        {
                            campIdVsAccIdSet_Month.get(meetObj.Campaign_lookup__c).add(meetObj.Contact__r.AccountId);
                        }
                    }
                    if((meetObj.Booked_Date__c).toStartofWeek()==Week){
                        if(!campIdVsAccIdSet_Week.keySet().contains(meetObj.Campaign_lookup__c))
                        {
                            accIdSet_Week= new Set<Id>();
                            accIdSet_Week.add(meetObj.Contact__r.AccountId);
                            campIdVsAccIdSet_Week.put(meetObj.Campaign_lookup__c,accIdSet_Week);
                        }
                        else
                        {
                            campIdVsAccIdSet_Week.get(meetObj.Campaign_lookup__c).add(meetObj.Contact__r.AccountId);
                        }
                    }
                }
                if(!campIdVsAccIdSet.keySet().contains(meetObj.Campaign_lookup__c))
                {
                    accIdSet= new Set<Id>();
                    accIdSet.add(meetObj.Contact__r.AccountId);
                    campIdVsAccIdSet.put(meetObj.Campaign_lookup__c,accIdSet);
                }
                else
                {
                    campIdVsAccIdSet.get(meetObj.Campaign_lookup__c).add(meetObj.Contact__r.AccountId);
                }
            }
            if(meetObj.Contact__c!=null){
                            //--------------
                if(meetObj.Booked_Date__c!=null)
                {
                    if((meetObj.Booked_Date__c).Month()==Month){
                        if(!campIdVsConIdEngSet_Month.keySet().contains(meetObj.Campaign_lookup__c))
                        {
                            contIdEngSet_Month= new Set<Id>();
                            contIdEngSet_Month.add(meetObj.Contact__c);
                            campIdVsConIdEngSet_Month.put(meetObj.Campaign_lookup__c,contIdEngSet_Month);
                        }
                        else
                        {
                            campIdVsConIdEngSet_Month.get(meetObj.Campaign_lookup__c).add(meetObj.Contact__c);
                        }
                    }
                    if((meetObj.Booked_Date__c).toStartofWeek()==Week){
                        if(!campIdVsConIdEngSet_Week.keySet().contains(meetObj.Campaign_lookup__c))
                        {
                            contIdEngSet_Week= new Set<Id>();
                            contIdEngSet_Week.add(meetObj.Contact__c);
                            campIdVsConIdEngSet_Week.put(meetObj.Campaign_lookup__c,contIdEngSet_Week);
                        }
                        else
                        {
                            campIdVsConIdEngSet_Week.get(meetObj.Campaign_lookup__c).add(meetObj.Contact__c);
                        }
                    }
                }
                //------------
                if(!campIdVsConIdEngSet.keySet().contains(meetObj.Campaign_lookup__c))
                {
                    contIdEngSet= new Set<Id>();
                    contIdEngSet.add(meetObj.Contact__c);
                    campIdVsConIdEngSet.put(meetObj.Campaign_lookup__c,contIdEngSet);
                }
                else
                {
                    campIdVsConIdEngSet.get(meetObj.Campaign_lookup__c).add(meetObj.Contact__c);
                }
            }
        }
        List<Campaign> campObjList= new List<Campaign>();
        For(Campaign campObj : [Select id,Con_Meeting_count__c,Acc_Meeting_count__c,Engage_count__c,Meeting_count__c,(Select Name From Meetings__r WHERE CreatedDate > LAST_WEEK), (Select Name From DMCs__r WHERE CreatedDate > LAST_WEEK ) from Campaign where Id in : campaignIdSet])
        {
            campObj.Acc_Meeting_count__c=campIdVsAccIdSet_Week.get(campObj.Id)!=null?campIdVsAccIdSet_Week.get(campObj.Id).size():0;
            campObj.Con_Meeting_count__c=campIdVsConIdEngSet_Week.get(campObj.Id)!=null?campIdVsConIdEngSet_Week.get(campObj.Id).size():0;
            
            campObj.Engage_count__c=campObj.Meetings__r.size();
            campObj.Meeting_count__c=campObj.DMCs__r.size();
            campObjList.add(campObj);
        }
        update campObjList;
        return campObjList;
        }
    }

Error message on save VF Component: Create property of getAccountContactEngCount_Method while saving  

Thanks in advance,
Kamala
,
Hi,

Anyone could help how to play the trailhead quest to receive the award.

Thanks in advance!

Regards,
Kamala.K
Hi,

Challenge Not yet complete... here's what's wrong: 
An Opportunity with the Stage 'Negotiation/Review' and the Amount greater than $100,000 was not successfully submitted for approval upon creation.

I have the above error while check challenge the 5th stage of process automation specialist.

Thanks in advance.

Best Regards
Kamala.
Challenge Not yet complete... here's what's wrong:  The 'Number of Days Open' formula field did not return the correct number of days. Please recheck the formula.

I have this issue when am going to verify step in trailhead.Project-Build aSuggestion Box App

Thanks in Advance!
Kamala
i have custom field called Revenue on opportunity object the condition is, if lead source is web and the amount is greater than 1000 then the revenue is 2% of the amount.
if lead source is web and the amount is lesser than 1000 then the revenue is 1% of the amount.
if lead source is apart from the above  then the revenue is 25% of the amount.
 
I am trying to write a VR that prevents a case from being closed if it's not owned by a user. It also include several other statements that should apply.  It should fire with any RT with any of the closed statuses listed but it's not.  Any assistance is greatly appreciated! Thank you!


AND
(
NOT($Setup.Global_System_Flags__c.Disable_Validation_Rules__c),
NOT CONTAINS(Source:EmailMessage.FromAddress, "@greenhouse.io"),
LEFT(OwnerId,3) <> '005',

AND(
OR(
(RecordType.Name = 'A'),
(RecordType.Name = 'B'),
(RecordType.Name = 'C'),
(RecordType.Name = 'D'),
(RecordType.Name = 'E'),
(RecordType.Name = 'E')),

OR
(
ISPICKVAL(Status, 'Closed'),
ISPICKVAL(Status, 'Duplicate'),
ISPICKVAL(Status, 'Canceled'),
ISPICKVAL(Status, 'Resolved'),
ISPICKVAL(Status, 'Reassigned')
)
)
)

Apex class
global class ModelLevel{
global static String getfunction(){
      String fpmsg;
      User usr = [select Id,Name,accountid,c_User_Country__c From User where Id = :UserInfo.getUserId() LIMIT 1];
 List<ObjectA__c> rcmsg = new List<ObjectA__c>();
      rcmsg  =[SELECT body__c from ObjectA__c where Type__C='homemessage' AND Country__c=:usr.c_User_Country__c  LIMIT 1];
           if(rcmsg!=null && !rcmsg.isEmpty() ){
               if(rcmsg[0].body__c!=null && rcmsg[0].body__c!=''){
                   fpmsg =rcmsg[0].body__c;
                    }
               else{
                   rcmsg =[SELECT id,name,Title__c,body__c from ObjectA__c where Type__C='homemessage' AND Country__c ='Global' LIMIT 1];
                                                fpmsg= rcmsg[0].body__c;
     }
          }
               else{
               rcmsg =[SELECT id,name,Title__c,body__c from ObjectA__c where Type__C='homemessage' AND Country__c ='Global' LIMIT 1];
                              fpmsg= rcmsg[0].body__c;
      }
      return fpmsg.unescapeHtml4();  
    }
########################################################
Test class

@isTest
Global class Modelleveltest
{

 private static testMethod void test_getfunction (){
        Account acc = CreateTestDataUtility.createAccount();
        Contact con = CreateTestDataUtility.createContact(acc);
        Contact con1 = CreateTestDataUtility.createContact(acc);
                Profile p = [SELECT Id FROM Profile WHERE Name = 'Sales User' LIMIT 1];
                 User localUser= new User
                profileId = p.id,
                username = 'Test33@test.com.test',
                email = 'Test33@test.com.test',
                emailencodingkey = 'UTF-8',
                localesidkey = 'en_US',
                languagelocalekey = 'en_US',
                timezonesidkey='America/Los_Angeles',
                alias='test22',
                lastname='Testing22',
                contactId=con.id,
                country =  'Turkey',
                Geographic_Region__c='Europe',                  
                c_User_Country__c = 'Turkey',
                User_Region__c = 'Turkey'
            );
        insert localUser;
       
        User TestUser= new User(
                          
                profileId = p.id,
                username = '23@test.com.test',
                email = '23@test.com.test',
                emailencodingkey = 'UTF-8',
                localesidkey = 'en_US',
                languagelocalekey = 'en_US',
                timezonesidkey='America/Los_Angeles',
                alias='newtest3',
                lastname='Testing3',
                contactId=con1.id,
                country = 'France',
                Geographic_Region__c='Europe',                   
                c_User_Country__c = 'France',
                User_Region__c = 'France'
            );
               insert TestUser;
List< ObjectA__c > Newval = new List< ObjectA__c >();
ObjectA__c usr1 = new ObjectA__c (Name='Content11',Country__c='Turkey',Customer_Type__c='Distributor',Title__c='Test Content',Body__c='Testconentnew',Type__c=' homemessage ');
Newval.add(usr1);
ObjectA__c usr2 = new ObjectA__c (Name='Content22',Country__c='Global',Customer_Type__c='Distributor',Title__c='Test Content test',Body__c='TestContentnewmsg',Type__c=' homemessage ');
Newval.add(usr2);
insert Newval;
        Test.StartTest();
        System.runAs(localUser){
  ModelLevel. getfunction ();
        }
                System.runAs(TestUser){
  ModelLevel. getfunction ();
                }
            Test.StopTest();
        }
}




      
 
Hi. I am writing a report on a custom object. 
I have an issue with creating the report 

mu records have quantity and status 
I want to get a summary of each record in different statuses. 
How it can be done? 

report on custom object
Hi All, 

Many thanks in advance for reading.

I have a class that works as expected on single record updates but when it fires on mass inserts or updates it assigns the same value accross each batch... 

the code block is finding the previous order record and assigning the dispatch date of the previous record to the current record (so we can then calculate time between orders, etc.)

I beleive the issue is in the LastOrder list and that its assigning the same value to all records in each batch but I'm unsure of the solution in the code block and would really appreicate some assistance? 

Many thanks 
 
public class OrderTriggerHandler {
    
    public static void OrderName(List<Order__c> orderlist){
    
    Id AccId;
    Date DisDate;
        
        for(Order__c a:orderlist) {
            AccId = a.Account__c;
            DisDate = a.Dispatch_Date__c;
            System.debug('AccId: ' + AccId);
            System.debug('DisDate: ' + DisDate);
        }
        
    	List<Order__c> LastOrder = [Select Id,Dispatch_Date__c,Account__c From Order__c 
                                Where Account__c =: AccId AND Dispatch_Date__c <: DisDate 
                                Order By Dispatch_Date__c DESC 
                                LIMIT 1];
        System.debug('LastOrder List Size: ' + LastOrder.size());
        
        For(Order__c ol : orderlist){
        For(Order__c o : LastOrder ){
            ol.Previous_Order_Date__c = o.Dispatch_Date__c;
                System.debug('Previous_Order_Date__c: ' + ol.Previous_Order_Date__c);
                System.debug('Dispatch_Date__c: ' + o.Dispatch_Date__c);
        
        }
     }

 

Hello,

I am stuck on a validation rule -

If Sub Category is either 'Attestation Form Complete' or 'Attestation Form Incomeplete', all the other fields listed must not be blank.

The current formula will not let me create the record even if all the fields listed are completed.  Any suggestions would be helpful.
 

Thanks!
User-added image

Hi
i have a formula field regularitives it is a formula field which is referrencing the field on oppty object and it is a picklist field now i have to write a validation rule such that when regularitive = canada then stage and status is new other wise error should come.
We need 3 custom fields on Account object:
1. Count of Closed Won Opportunities for Curent year
2. Count of Closed Won Opportunities for current quarter
3. Count of Closed Won Opportunities for current month
PFA of error
I am developing the app on a new playground platform launched today itself. Still getting the attached error.
Please let me know any action items if needed to be done from myside to resolve the issue.
Hi all,

I have created a process builder with approval process.
However, there are 2 fields that are showing 0 or null dispite having values.

User-added image
My fields setup:
User-added imageUser-added imageUser-added image

Question:
1. Does forumla not able to be processed in proecess bui;lder?
2, Im using multi-currency and can the process builder identify which currency from QUote and do a calculation?
 
My requirement is
a]  to add a custom field say warranty__c in Products object, then show that in opportunity line items while creating a new opportunity.
b] then I will convert the opporutnity line items to quote ine items but I think custom field is not converted.

I added a custom field warranty__c to Product Object but I am not able to see this field while creating line items in opportunity.
Please let me know.

thanks
sheila.

 
Hi,

I have built a process that should change the case owner if the contact owner is changed but only for a specified case record type, the issue is that it is changing all cases. 
Please see process below, have I missed somthing?
User-added image

User-added image

User-added image
I have used the 18 digit id as I thought that was the issue but still the same result. 

Any advice welcome.
Thank You,
Lorr
  • August 14, 2018
  • Like
  • 0
Hi All,
I have a validation rule on the contract object which doesn't allow a checkbox to be checked by users until they have completed the required fields. The issue is that some of these fields are picklist values and are very much needed. Here is the rule with the other fields (without the picklist ones):
AND( 
OR( 
ISBLANK (Knowledge__c ), 
ISBLANK(Functional_Skills__c), 
ISBLANK(App_Attendance_Absent__c), 
ISBLANK(App_Attendance_Late__c), 
ISBLANK(App_Attendance_Present__c), 
ISBLANK(App_Attendance_Present_including_Late2__c), 
ISBLANK(How_can_you_improve_your_score__c), 
ISBLANK(Apprentice__c), 
ISBLANK(Career_Options__c), 
ISBLANK(Competency__c), 
ISBLANK(Date_of_last_Review__c), 
ISBLANK(Date_of_this_review__c ), 
ISBLANK(Due_Date_1__c), 
ISBLANK(Due_Date_2__c), 
ISBLANK(Due_Date_3__c), 
ISBLANK(Employer_Representative_Comments__c), 
ISBLANK(English_Diagnostic_Assessment__c), 
ISBLANK(Functional_Skills__c), 
ISBLANK(Health_Safety_E_D_topic__c), 
ISBLANK(How_would_you_score_yourself__c), 
ISBLANK(Issues_or_Concerns__c), 
ISBLANK(LDS_Comments__c), 
ISBLANK(LDS_How_to_improve_score_next_month__c), 
ISBLANK(maths_English__c), 
ISBLANK(maths_Diagnostic_Assessment__c), 
ISBLANK(Overall_Progress_Blue__c), 
ISBLANK(Overall_Progress_Green__c), 
ISBLANK(Overall_Progress_Orange__c), 
ISBLANK(PDP__c), 
ISBLANK(Projects_or_areas_of_work__c), 
ISBLANK(Review_Location__c), 
ISBLANK(Safeguarding_topic__c), 
ISBLANK(Score_for_the_month__c), 
ISBLANK(LDS_Score_for_the_month__c), 
ISBLANK(Target_1__c), 
ISBLANK(Target_2__c), 
ISBLANK(Target_3__c), 
ISBLANK(To_keep_myself_and_others_safe_I_can__c), 
ISBLANK(Work_Attendance_Late__c), 
ISBLANK(Work_Attendance_Sick__c) 
), 
Review_Completed__c = true 
)
Here are the picklist values:
ISBLANK(All_Smart_Targets_met__c),
   ISBLANK(Additional_Support__c),
   ISBLANK(Apprentice_of_the_month__c),
   ISBLANK(Apprenticeship_work__c),
   ISBLANK(At_risk_record_to_be_created_or_updated__c),
   ISBLANK(Do_we_need_to_open_FS_aims__c),
   ISBLANK(Enrichment_sessions__c),
   ISBLANK(For_Whom__c),
   ISBLANK(For_Whom_2__c),
   ISBLANK(For_Whom_3__c),
   ISBLANK(Is_employer_partnerships_input_required__c),
   ISBLANK(Is_the_manager_happy_generally__c),
   ISBLANK(Qualification_Level__c),
   ISBLANK(Reflective_log__c),
   ISBLANK(Target_Type_1__c),
   ISBLANK(Target_Type_2__c),
   ISBLANK(Target_Type_3__c),
   ISBLANK(The_Employer_Reference__c),
   ISBLANK(Upcoming__c),
Thaaaanks :)