• lalit kumar 11
  • NEWBIE
  • 35 Points
  • Member since 2016


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 4
    Replies
I am trying to maintain my PD I certification since a few days but i am getting the below error on checking challenge "Challenge not yet complete in Certification Org There was an issue processing your verification. Please refresh the page and try again."
Today is the last day of maintaining certification else it will be expired.
Please help.
Hi, 
I am trying to make a count of tasks on a custom field (total_tasks__c) on Account. I am not sure why its not showing the count. Below is the code. 

trigger taskcount on Task (after insert) {
set<id> setid = new set<id>();
list<account> acc3 = new list<account>();

for(task t :trigger.new){
 if(string.valueof(t.whatid).startsWith('OO1') & t.whatid != null)

{
setid.add(t.whatId);    
}
for(account acc1 :[select id,(select id from tasks) total_tasks__c from account where id in:setid]){
if(acc1.Tasks.size()>0)
acc1.total_tasks__c = acc1.tasks.size();
acc3.add(acc1);
}

}
update acc3;
}

Please help to resolve the issue.
Hi all
I am getting difficulty in integrating salesforce's events to the ms 365 calender.  The reference i took is https://trailhead.salesforce.com/en/microsoft_integration_admin_set_up_integration_products/microsoft_integration_admin_set_up_app_for_outlook_unit_1

I got stuck in verifying the Microsoft connectivity test. This is what it says :
Connectivity Test Failed
 
"Test Details
Exchange Web Services service account access verification
 The Microsoft Connectivity Analyzer failed to complete all tests with the service account.
 Additional Details
 Elapsed Time: 13000 ms.
 Test Steps
 The Microsoft Connectivity Analyzer is attempting to test Autodiscover for hsl@urchinomics.com.
 Autodiscover was tested successfully.
 Additional Details
 Elapsed Time: 12386 ms.
 Test Steps
 Attempting each method of contacting the Autodiscover service.
 The Autodiscover service was tested successfully.
 Additional Details
 Test Steps
A new mail item is being created.
 The attempt to create a mail item failed.
 Additional Details"

One thing i dont understand why we have to make a separate service account in ms 365 in order to inpersonate the desired account with salesforce account. 

What i am missing ? How can i overcome this connectivity issue ? 
Any help will be highly appreciated. 



 
Hi there,

I am trying to run a trigger for a while with different patterns but not getting the results except errors.
One custom field(value_to_be_copied__c) is on lead and one custom field(copied_value__c ) is on task.
The condition is whenever a task related to a lead is created, the value of value_to_be_copied__c should be copied to copied_value__c. 
First pattern is :-
trigger leadtasktrigger on Task (after insert) {

set<id> leid = new set<id>();
for(task ta :trigger.new){
if(string.valueof(ta.whoid).startsWith('OOQ'))
        {
          leid.add(ta.whoid);
         }
       }
 for(lead le2 :[select id, (select id, subject, copied_value__c from task), value_to_be_copied__c from lead where id in :leid]){
   le2.task.copied_value__c = le2.value_to_be_copied__c;
 }
}

Error for the above code is 
Error: Compile Error: Didn't understand relationship 'task' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names. at line 10 column 16

Second pattern is -

trigger leadtasktrigger on Task (after insert) {

set<id> taid = new set<id>();
list<task> taid1 = new list<task>();
for(task ta :trigger.new){
if(string.valueof(ta.whoid).startsWith('OOQ'))
        {
          taid.add(ta.id);
         }
       }
   for(task ta1 : [select id, subject, copied_value__c, whoid from task where id in: taid]){
     
     taid1.add(ta1);
     
   } 
   
   for(task ta2 : taid){
   ta2.copied_value__c = ta2.who.value_to_be_copied__c ;
   }
 }
Error: Compile Error: Invalid field value_to_be_copied__c for SObject Name at line 18 column 26.

Please help .. TIA..    
 
how to automatically assign the permission set to a new user in trigger.new context
I have a requirement where i have to assign different permission set to the users (in trigger.new context) having the different profile.

I made two custom permission sets.

When i am inserting the new user with the new profileId as of standard user (00e28000001izYq), the permission
set gets assigned appropriately but when i am inserting the new user with profileId of standard user (00e28000001izYFAAY) it gives me the following error :

Error: Invalid Data. 
Review all error messages below to correct your data.
Apex trigger userpermsetassignment caused an unexpected exception, contact your administrator: userpermsetassignment: execution of AfterInsert caused by: System.QueryException: List has no rows for assignment to SObject: Trigger.userpermsetassignment: line 2, column 1

I am not sure, what is missing here.
 
Here is my code :
trigger userpermsetassignment on User (after insert) {
user us = [select id, ProfileId from user where id in :trigger.new];
    system.debug(us.id);
    
    PermissionSet ps =  [SELECT Id, UserLicenseId FROM PermissionSet
                         WHERE Id = '0PS280000003efa'];
    system.debug('userlicenseid======>'+ps.UserLicenseId);
     
     system.debug('userlicenseid after assignment======>'+ps.UserLicenseId);
    
    PermissionSet ps2 =  [SELECT Id, UserLicenseId FROM PermissionSet
                       WHERE Id = '0PS280000003emC'];
                       
    //PermissionSetAssignment psa = [SELECT Id, AssigneeId, PermissionSetId FROM PermissionSetAssignment
                             //  WHERE AssigneeId = :us.id];
    // below condition contains the profileId for system administrator 
     
    if(us.ProfileId == '00e28000001izYFAAY' ){                 
PermissionSetAssignment psa = new PermissionSetAssignment(PermissionSetId = ps.id, AssigneeId = us.id);
insert psa;  
          system.debug(psa.AssigneeId);     
    } 
    
    // below condition contains the profileId for standard User  
   else if(us.ProfileId == '00e28000001izYq' ){                 
PermissionSetAssignment psa2 = new PermissionSetAssignment(PermissionSetId = ps2.id, AssigneeId = us.id);
insert psa2;  
          system.debug(psa2.AssigneeId);
    } 
   
  
         
    }

Thanks :)
 lalit
Hi Salesforce Gurus,

what is the way to access Custom Settings value based on Current User's profile in Visualforce ?

Thanks
Lalit
hi ,
 Can anyone guide me through the basic difference between invoking apex in execute anonymous vs. unit tests or if there is any specific document on this difference ? 


Thanks
lalit
I am trying to maintain my PD I certification since a few days but i am getting the below error on checking challenge "Challenge not yet complete in Certification Org There was an issue processing your verification. Please refresh the page and try again."
Today is the last day of maintaining certification else it will be expired.
Please help.
Hi there,

I am trying to run a trigger for a while with different patterns but not getting the results except errors.
One custom field(value_to_be_copied__c) is on lead and one custom field(copied_value__c ) is on task.
The condition is whenever a task related to a lead is created, the value of value_to_be_copied__c should be copied to copied_value__c. 
First pattern is :-
trigger leadtasktrigger on Task (after insert) {

set<id> leid = new set<id>();
for(task ta :trigger.new){
if(string.valueof(ta.whoid).startsWith('OOQ'))
        {
          leid.add(ta.whoid);
         }
       }
 for(lead le2 :[select id, (select id, subject, copied_value__c from task), value_to_be_copied__c from lead where id in :leid]){
   le2.task.copied_value__c = le2.value_to_be_copied__c;
 }
}

Error for the above code is 
Error: Compile Error: Didn't understand relationship 'task' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names. at line 10 column 16

Second pattern is -

trigger leadtasktrigger on Task (after insert) {

set<id> taid = new set<id>();
list<task> taid1 = new list<task>();
for(task ta :trigger.new){
if(string.valueof(ta.whoid).startsWith('OOQ'))
        {
          taid.add(ta.id);
         }
       }
   for(task ta1 : [select id, subject, copied_value__c, whoid from task where id in: taid]){
     
     taid1.add(ta1);
     
   } 
   
   for(task ta2 : taid){
   ta2.copied_value__c = ta2.who.value_to_be_copied__c ;
   }
 }
Error: Compile Error: Invalid field value_to_be_copied__c for SObject Name at line 18 column 26.

Please help .. TIA..    
 
I have seen a few people post issues with Salesforce for Outlook and when instaling getting the >net frameworks error.  Mine says I have the .net 4.5.2, but when I try to uncheck it, it won't let me.

I also tried looking for an install and uninstall option and that didn't work either. 

Help, I am a director and since I purchased a new PC (my last PC did have windows 10 on it, but it was upgraded from XP), my new one came with Win 10, I can not get it to install

thanks
how to automatically assign the permission set to a new user in trigger.new context
I have a requirement where i have to assign different permission set to the users (in trigger.new context) having the different profile.

I made two custom permission sets.

When i am inserting the new user with the new profileId as of standard user (00e28000001izYq), the permission
set gets assigned appropriately but when i am inserting the new user with profileId of standard user (00e28000001izYFAAY) it gives me the following error :

Error: Invalid Data. 
Review all error messages below to correct your data.
Apex trigger userpermsetassignment caused an unexpected exception, contact your administrator: userpermsetassignment: execution of AfterInsert caused by: System.QueryException: List has no rows for assignment to SObject: Trigger.userpermsetassignment: line 2, column 1

I am not sure, what is missing here.
 
Here is my code :
trigger userpermsetassignment on User (after insert) {
user us = [select id, ProfileId from user where id in :trigger.new];
    system.debug(us.id);
    
    PermissionSet ps =  [SELECT Id, UserLicenseId FROM PermissionSet
                         WHERE Id = '0PS280000003efa'];
    system.debug('userlicenseid======>'+ps.UserLicenseId);
     
     system.debug('userlicenseid after assignment======>'+ps.UserLicenseId);
    
    PermissionSet ps2 =  [SELECT Id, UserLicenseId FROM PermissionSet
                       WHERE Id = '0PS280000003emC'];
                       
    //PermissionSetAssignment psa = [SELECT Id, AssigneeId, PermissionSetId FROM PermissionSetAssignment
                             //  WHERE AssigneeId = :us.id];
    // below condition contains the profileId for system administrator 
     
    if(us.ProfileId == '00e28000001izYFAAY' ){                 
PermissionSetAssignment psa = new PermissionSetAssignment(PermissionSetId = ps.id, AssigneeId = us.id);
insert psa;  
          system.debug(psa.AssigneeId);     
    } 
    
    // below condition contains the profileId for standard User  
   else if(us.ProfileId == '00e28000001izYq' ){                 
PermissionSetAssignment psa2 = new PermissionSetAssignment(PermissionSetId = ps2.id, AssigneeId = us.id);
insert psa2;  
          system.debug(psa2.AssigneeId);
    } 
   
  
         
    }

Thanks :)
 lalit