• Sfdc Siva
  • NEWBIE
  • 20 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 13
    Questions
  • 12
    Replies
Hi All,

When we are try to changing the Picklist field on Opportunity we are getting below error.
Error element myRule_1_A1 (FlowRecordCreate). This error occurred when the flow tried to create records: INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST: Need Help: bad value for restricted picklist field 

Can any one please help us to avoid this error.

Thanks
Hi All,

Can any one help me to avoid 201 SOQL Error When we are running the batch getting the error.Please help me to avoid this.


Thanks
Hi Team,

Can any one please help me to create if contract enddate is changed manually then new opportunity needs to be create which is assosciate to lookup account on contract object.

Thanks

 
Hi Team,

In contact object we have one checkbox field "partneruser" This checbox is when partner user is created automaticlly the chckbox got checked on contact which is working fine.Problem is when we are tying to deactiveate the partner user needs to be unchecked partneruser checbox on contact page.
Please help us to creating a  logic or processbuilder or workflow.

Thanks
 
Hi Team,

Can any one please help me to create a test class.I have tried below testclass but i didn't get  any code coverage.please help me to increase code coverage.

@isTest

private class PartnerriggerTest
{
    Static testMethod void testPartnerTrigger()
    {
        Account acc = new Account(Name = 'newAcc');  
        insert acc;
        Contact con = new Contact(AccountId = acc.id,LastName = 'portalTestUser');
        insert con;
        Profile p = [select id from Profile where UserLicense.name = ' High Volume ' limit 1];
        User usr = new User();
        usr.LastName = 'TestUser';
        usr.Alias = 'tesUr';
        usr.Email = 'tstUsr@test.com';
        usr.UserName = 'tstUsr+11@test.com';
        usr.CommunityNickname = 'tsta211';
        usr.TimeZoneSidKey = 'America/New_York';
        usr.LocaleSidKey = 'en_US';
        usr.EmailEncodingKey = 'ISO-8859-1';
        usr.ProfileId = p.Id;
        usr.LanguageLocaleKey = 'en_US';
        usr.ContactId = con.Id;
      
        insert usr;
    }
}

Thanks
Hi All,
We are checking the couple of conditions based on javascript logic.
Contact email checking: if the contact email is already associated with some other user we needs to be popup message like:
"User is already exists with the same email".
Partner Licence checking: if there is no licences then we need to popup message like "You have not enough license available".

I have tried below Javascript logic, the above points are not working.Can any one please help us.

Thanks
Hi Team,

Am facing to include the contact firstname and last name on below statement.

Your request to grant new partner user access to the traditional partner portal has been provided.
We wants to be display like ":  Your request to grant new user access to the traditional partner portal for ContactFirstName ContactLastName has been provided."
I have tried below statement which is not working.

body=body+'Your request to grant new partner user access to the traditional partner portal for +u.FirstName+', '+u.LastName+ has been provided.<br/><br/>'; 

Can any one please help us for this issue.

Thanks

 
Hi All,
Can any one please help us to avoid the below error  "System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_USERNAME, Duplicate Username.The username already exists in this or another Salesforce organization.Usernames must be unique across all Salesforce organizations."

Below is my trigger:

trigger PartnerUserTrigger on Partner_Access_Request__c(after update)
{
    List<User> lst_User = new List<User>();
    Set<Id> set_Id = new Set<Id>();
    Set<Id> setrej_Id = new Set<Id>();
    map<id,string> cremail = new map<id,string>();
    Map<Id,User> mp_User = new Map<Id,User>();
    list<Contact> con_List = new List<Contact>();
    List<String> sendTo = new List<String>();
    List<String> sendToCC = new List<String>();
    List<String> sendToCCorg = new List<String>();
    Map<String,Contact> contactMap =new Map<String,Contact>();
    for(User usr : [Select Id,ContactId,isActive from User where ContactId!=null and isActive=true])
    {
        mp_User.put(usr.ContactId,usr);
    }
    User user_Recd = [Select Id,LastName,Username,Profile.Name,Email,Alias,CommunityNickname,TimeZoneSidKey,LocaleSidKey,ContactId,EmailEncodingKey,ProfileId,LanguageLocaleKey from user where Profile.Name='Partner Sales Leader' And ContactId!=null limit 1];
    for(Partner_Access_Request__c Partner_Recd : Trigger.new)
    {
        if(Partner_Recd.Status__c=='Approved' && Partner_Recd.Status__c!=Trigger.oldMap.get(Partner_Recd.id).Status__c)
        {
            set_Id.add(Partner_Recd.id);
        }
        if(Partner_Recd.Status__c=='Rejected' && Partner_Recd.Status__c!=Trigger.oldMap.get(Partner_Recd.id).Status__c)
        {
            setrej_Id.add(Partner_Recd.id);
        }
    }    
    if(set_Id!=null && !set_Id.isEmpty())
    {
        for(Partner_Access_Request__c Partner_User_Recd : [Select Id,Partner_Contact__c,Status__c,CreatedBy.Email,Partner_Contact__r.Partner_User__c,Partner_Contact__r.Email,Partner_Contact__r.Name,Partner_Contact__r.Title,Partner_Contact__r.Department,Partner_Contact__r.FirstName,Partner_Contact__r.LastName,Partner_Contact__r.MailingCity,Partner_Contact__r.MailingState,Partner_Contact__r.MailingCountry,Partner_Contact__r.MailingPostalCode,Partner_Contact__r.MailingStreet from Partner_Access_Request__c where Id IN:set_Id])
        {             
            if(mp_User!=null && !mp_User.containsKey(Partner_User_Recd.Partner_Contact__c))
            {
                User PartnerUser_Recd = new user();
                PartnerUser_Recd.Username = Partner_User_Recd.Partner_Contact__r.Email;
                PartnerUser_Recd.FirstName = Partner_User_Recd.Partner_Contact__r.FirstName;
                PartnerUser_Recd.LastName= Partner_User_Recd.Partner_Contact__r.LastName;
                PartnerUser_Recd.Email = Partner_User_Recd.Partner_Contact__r.Email;    
                        
                PartnerUser_Recd.Alias = Partner_User_Recd.Partner_Contact__r.Name.subString(0,3);
                PartnerUser_Recd.ContactId = Partner_User_Recd.Partner_Contact__c;
                PartnerUser_Recd.Title = Partner_User_Recd.Partner_Contact__r.Title;
                PartnerUser_Recd.Department = Partner_User_Recd.Partner_Contact__r.Department;
                PartnerUser_Recd.TimeZoneSidKey= user_Recd.TimeZoneSidKey; 
                PartnerUser_Recd.LocaleSidKey= user_Recd.LocaleSidKey;
                PartnerUser_Recd.EmailEncodingKey =user_Recd.EmailEncodingKey;
                PartnerUser_Recd.ProfileId=user_Recd.ProfileId;
                PartnerUser_Recd.LanguageLocaleKey =user_Recd.LanguageLocaleKey;             
                PartnerUser_Recd.City = Partner_User_Recd.Partner_Contact__r.MailingCity;
                PartnerUser_Recd.State = Partner_User_Recd.Partner_Contact__r.MailingState;
                PartnerUser_Recd.Country= Partner_User_Recd.Partner_Contact__r.MailingCountry;
                PartnerUser_Recd.PostalCode = Partner_User_Recd.Partner_Contact__r.MailingPostalCode;
                PartnerUser_Recd.Street = Partner_User_Recd.Partner_Contact__r.MailingStreet;
                PartnerUser_Recd.isActive = true;
                if(Partner_User_Recd.Partner_Contact__r.Firstname!=null)
                    PartnerUser_Recd.CommunityNickname = Partner_User_Recd.Partner_Contact__r.Firstname.subString(0,2);
                if(Partner_User_Recd.Partner_Contact__r.lastname!=null)
                    PartnerUser_Recd.CommunityNickname =PartnerUser_Recd.CommunityNickname +Partner_User_Recd.Partner_Contact__r.lastname.subString(0,3);
                cremail.put(Partner_User_Recd.Partner_Contact__c,Partner_User_Recd.CreatedBy.Email); 
                //PartnerUser_Recd.CommunityNickname = '';
                lst_User.add(PartnerUser_Recd);
                Partner_User_Recd.Partner_Contact__r.Partner_User__c = true;
                con_List.add(Partner_User_Recd.Partner_Contact__r);
            }
             //}
        }
    }
    List<Messaging.SingleEmailMessage> mails = new List<Messaging.SingleEmailMessage>();
    if(lst_User!=null && !lst_User.isEmpty())
    {
        system.debug('@@@@'+ lst_User);
    insert lst_User;
    }
    if(con_List!=null && con_List.size()>0)
        update con_List;
    for(PartnerUserEmail__c pue : PartnerUserEmail__c.getall().values())
    {
        sendToCCorg.add(pue.name);
    }
    for(user u: lst_User)
    {
      
          sendTo.Add(cremail.get(u.contactid));
  
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        mail.setToAddresses(sendTo);
     
        mail.setSubject('New Partner Access provided');
        String body = 'Hi' ;
        if(u.FirstName!=null)
            body=body+u.FirstName;
        if(u.LastName!=null)
            body=body+u.LastName;
        body=body+'<br/><br/>';      
        body=body+'Your request to grant new partner user access to the traditional partner portal has been provided.<br/><br/>';
              
        body=body+'Thanks,<br/>';
        body=body+'Support Team';
        mail.setHtmlBody(body);
        mails.add(mail);
    }
 
    if(setrej_Id.size()>0)
    {  
        for(Partner_Access_Request__c Partner_User_Recd : [Select Id,Partner_Contact__c,Status__c,CreatedBy.email,Partner_Contact__r.Partner_User__c,Partner_Contact__r.Email,Partner_Contact__r.Name,Partner_Contact__r.Title,Partner_Contact__r.Department,Partner_Contact__r.FirstName,Partner_Contact__r.LastName,Partner_Contact__r.MailingCity,Partner_Contact__r.MailingState,Partner_Contact__r.MailingCountry,Partner_Contact__r.MailingPostalCode,Partner_Contact__r.MailingStreet from Partner_Access_Request__c where Id IN:setrej_Id])    
        {
            sendTo.add(Partner_User_Recd.Partner_Contact__r.Email);
            sendToCC.add(Partner_User_Recd.CreatedBy.Email); 
            sendToCC.addall(sendToCCorg);    
            Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
            mail.setToAddresses(sendTo);
            mail.setCcAddresses(sendToCC);
            mail.setSubject('New Partner Access Denied');
            String body = 'Hi ';
            if(Partner_User_Recd.Partner_Contact__r.FirstName!=null)
                body=body+Partner_User_Recd.Partner_Contact__r.FirstName;
            if(Partner_User_Recd.Partner_Contact__r.LastName!=null)
                body=body+Partner_User_Recd.Partner_Contact__r.LastName;
            body=body+'<br/><br/><br/>';
            body=body+'Your request for Partner portal access has been denied. <br/><br/><br/><br/>';
            body=body+'Thanks,<br/>';
            body=body+'Support Team';
            mail.setHtmlBody(body);
            mails.add(mail);
        }
    }
    if(mails.size()>0)
    {
        Messaging.sendEmail(mails);
    }
}

Thanks
Hi All,
Can anyone please help me to create if condition for below
1.If opportunity having Owner role= Partner and then it is getting closed within 30 days after creation and If opportunity contains any partner Relate list then check box is true
2.If opportunity does not having Owner role= Partner and then it is getting closed within 45 days after opportunity creation if opportunity does not contain any partner related lists then check box is true.
And there is an OR condition between these two.

Thanks
 
Hi All,

I have created onebatch apex as mentioend below.I want to scheduled the class everday midnight automatically.Can any one help me to create a Automatic scheduled class.

BatchApex:
global class OpportunitySplit implements Database.Batchable<Sobject>{
    global OpportunitySplit(){
    }
        //START Method
        global Database.QueryLocator start(Database.BatchableContext BC){
        DateTime dt = DateTime.now().addHours(-24);
        String query = 'SELECT Id,name,Total_Account_Manager__c,Total_Channel_Manager__c FROM Opportunity WHERE LastModifiedDate = ToDay ';
        return Database.getQueryLocator(query);
        }
        //execute Method
        global void execute(Database.BatchableContext BC,List<Opportunity> lstOpp){

            Map<Id,Integer> MapIdOppTosumAcMngr = new Map<Id,Integer>();
            Map<Id,Integer> MapIdOppTosumChMgnr = new Map<Id,Integer>();
            Map<Id,Opportunity> MapOpportunity = new Map<Id,Opportunity>(lstOpp);
            Opportunity objOppToUpdate;
            
            List<Opportunity> lstOppToUpdate = new List<Opportunity>();           
            for(OpportunitySplit objOppSplit : [SELECT Id, Role_Name__c, OpportunityId FROM OpportunitySplit WHERE Role_Name__c IN (' Account Manager',' Channel Manager') AND OpportunityId IN: MapOpportunity.keySet()]){                                     
                system.debug('====objOppSplit===='+objOppSplit);
                
                if(objOppSplit.Role_Name__c == 'Account Manager'){
                   
                    MapIdOppTosumAcMngr.put(objOppSplit.OpportunityId, MapIdOppTosumAcMngr.containsKey(objOppSplit.OpportunityId) ? (MapIdOppTosumAcMngr.get(objOppSplit.OpportunityId)+1): 1);
                }
                else{
                      
                     MapIdOppTosumChMgnr.put(objOppSplit.OpportunityId,MapIdOppTosumChMgnr.containsKey(objOppSplit.OpportunityId) ? (MapIdOppTosumChMgnr.get(objOppSplit.OpportunityId)+1): 1);
                    }
            }
            for(Opportunity objOpp : MapOpportunity.values()){
                objOppToUpdate = new Opportunity(Id = objOpp.Id);
                objOppToUpdate .Total_Account_Manager__c = MapIdOppTosumAcMngr.containsKey(objOpp.Id) ? MapIdOppTosumAcMngr.get(objOpp.Id) : 0;
                objOppToUpdate .Total_Channel_Manager__c = MapIdOppTosumChMgnr.containsKey(objOpp.Id) ? MapIdOppTosumChMgnr.get(objOpp.Id) : 0;
                
                lstOppToUpdate.add(objOppToUpdate );
            
                system.debug('====objOppToUpdate===='+objOppToUpdate);
            }
                if(!lstOppToUpdate.isEmpty())
                    
                    update lstOppToUpdate;         
        }
         //finish Method
                global void finish(Database.BatchableContext BC){
                    
                }
}

Thanks in Advance
Hi All,
Can any one help for creating batch apex using below requiremet.
We have three fields in Accounts.Those are 
     1. "Type" equals "Fd Gov't","LL Gov't","ST Gov't" 
      2. " Entity" Flag equals False 
       3. "Structure" equals " Agency ".
    
 If Type = "Fd Gov't","LL Gov't","ST Gov't"  And  "Structure" equals "Agency"  then  "Entity" Flag Should be "False".
    
Please help me to create a batch apex for above senario.

Thaks in Advance,
 
Hello All,

We have one senario mentioned below.

I have 4 fields like two are formula fields and  two are workflow fields.

The Conditions are:
when  Last 30 Days (Formula) is True, in Last 30 Days (Workflow) is TRUE (Viceversa)
when  Last 730 Days (Formula) is True, in Last 730 Days (Workflow) is TRUE (Viceversa)

We are trying to update through batch apex but we are facing some errors.Is there any possibility to acheive other than Batch apex ?. Please can any one update the better solution on this.

Thanks in Advance
Hi All,

We have one Formula field called "Contract End Date"  in Opportunity object ,Needs  to populate the "Contract End Date" on the Account "Service Contract End Date"  at the time of opp is created.

Can any one please help me to creating a trigger on above senario.

Thanks
 
Hi All,

Can any one help me to avoid 201 SOQL Error When we are running the batch getting the error.Please help me to avoid this.


Thanks
Hi Team,

Can any one please help me to create if contract enddate is changed manually then new opportunity needs to be create which is assosciate to lookup account on contract object.

Thanks

 
Hi Team,

In contact object we have one checkbox field "partneruser" This checbox is when partner user is created automaticlly the chckbox got checked on contact which is working fine.Problem is when we are tying to deactiveate the partner user needs to be unchecked partneruser checbox on contact page.
Please help us to creating a  logic or processbuilder or workflow.

Thanks
 
Hi Team,

Can any one please help me to create a test class.I have tried below testclass but i didn't get  any code coverage.please help me to increase code coverage.

@isTest

private class PartnerriggerTest
{
    Static testMethod void testPartnerTrigger()
    {
        Account acc = new Account(Name = 'newAcc');  
        insert acc;
        Contact con = new Contact(AccountId = acc.id,LastName = 'portalTestUser');
        insert con;
        Profile p = [select id from Profile where UserLicense.name = ' High Volume ' limit 1];
        User usr = new User();
        usr.LastName = 'TestUser';
        usr.Alias = 'tesUr';
        usr.Email = 'tstUsr@test.com';
        usr.UserName = 'tstUsr+11@test.com';
        usr.CommunityNickname = 'tsta211';
        usr.TimeZoneSidKey = 'America/New_York';
        usr.LocaleSidKey = 'en_US';
        usr.EmailEncodingKey = 'ISO-8859-1';
        usr.ProfileId = p.Id;
        usr.LanguageLocaleKey = 'en_US';
        usr.ContactId = con.Id;
      
        insert usr;
    }
}

Thanks
Hi Team,

Am facing to include the contact firstname and last name on below statement.

Your request to grant new partner user access to the traditional partner portal has been provided.
We wants to be display like ":  Your request to grant new user access to the traditional partner portal for ContactFirstName ContactLastName has been provided."
I have tried below statement which is not working.

body=body+'Your request to grant new partner user access to the traditional partner portal for +u.FirstName+', '+u.LastName+ has been provided.<br/><br/>'; 

Can any one please help us for this issue.

Thanks

 
Hi All,

I have created onebatch apex as mentioend below.I want to scheduled the class everday midnight automatically.Can any one help me to create a Automatic scheduled class.

BatchApex:
global class OpportunitySplit implements Database.Batchable<Sobject>{
    global OpportunitySplit(){
    }
        //START Method
        global Database.QueryLocator start(Database.BatchableContext BC){
        DateTime dt = DateTime.now().addHours(-24);
        String query = 'SELECT Id,name,Total_Account_Manager__c,Total_Channel_Manager__c FROM Opportunity WHERE LastModifiedDate = ToDay ';
        return Database.getQueryLocator(query);
        }
        //execute Method
        global void execute(Database.BatchableContext BC,List<Opportunity> lstOpp){

            Map<Id,Integer> MapIdOppTosumAcMngr = new Map<Id,Integer>();
            Map<Id,Integer> MapIdOppTosumChMgnr = new Map<Id,Integer>();
            Map<Id,Opportunity> MapOpportunity = new Map<Id,Opportunity>(lstOpp);
            Opportunity objOppToUpdate;
            
            List<Opportunity> lstOppToUpdate = new List<Opportunity>();           
            for(OpportunitySplit objOppSplit : [SELECT Id, Role_Name__c, OpportunityId FROM OpportunitySplit WHERE Role_Name__c IN (' Account Manager',' Channel Manager') AND OpportunityId IN: MapOpportunity.keySet()]){                                     
                system.debug('====objOppSplit===='+objOppSplit);
                
                if(objOppSplit.Role_Name__c == 'Account Manager'){
                   
                    MapIdOppTosumAcMngr.put(objOppSplit.OpportunityId, MapIdOppTosumAcMngr.containsKey(objOppSplit.OpportunityId) ? (MapIdOppTosumAcMngr.get(objOppSplit.OpportunityId)+1): 1);
                }
                else{
                      
                     MapIdOppTosumChMgnr.put(objOppSplit.OpportunityId,MapIdOppTosumChMgnr.containsKey(objOppSplit.OpportunityId) ? (MapIdOppTosumChMgnr.get(objOppSplit.OpportunityId)+1): 1);
                    }
            }
            for(Opportunity objOpp : MapOpportunity.values()){
                objOppToUpdate = new Opportunity(Id = objOpp.Id);
                objOppToUpdate .Total_Account_Manager__c = MapIdOppTosumAcMngr.containsKey(objOpp.Id) ? MapIdOppTosumAcMngr.get(objOpp.Id) : 0;
                objOppToUpdate .Total_Channel_Manager__c = MapIdOppTosumChMgnr.containsKey(objOpp.Id) ? MapIdOppTosumChMgnr.get(objOpp.Id) : 0;
                
                lstOppToUpdate.add(objOppToUpdate );
            
                system.debug('====objOppToUpdate===='+objOppToUpdate);
            }
                if(!lstOppToUpdate.isEmpty())
                    
                    update lstOppToUpdate;         
        }
         //finish Method
                global void finish(Database.BatchableContext BC){
                    
                }
}

Thanks in Advance
Hi All,
Can any one help for creating batch apex using below requiremet.
We have three fields in Accounts.Those are 
     1. "Type" equals "Fd Gov't","LL Gov't","ST Gov't" 
      2. " Entity" Flag equals False 
       3. "Structure" equals " Agency ".
    
 If Type = "Fd Gov't","LL Gov't","ST Gov't"  And  "Structure" equals "Agency"  then  "Entity" Flag Should be "False".
    
Please help me to create a batch apex for above senario.

Thaks in Advance,