• Shubham Sinha 49
  • NEWBIE
  • 40 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 19
    Questions
  • 7
    Replies
I need to show a custom  popup when there is no activity after 15 minutes on Community. I know there is a Salesforce out of the box functionality to show the popup when there is no activity but I need to customize the popup but I did not find any way to do that.So I thought to disable the Session setting popup and to create my own custom popup but I got stuck on the implementation that how to make the popup appear after 15 mins of inactivity.
Please help if someone has any idea on this.
Thanks in advance.
I have a class where we have used JSON.deserialise function but that function is not being covered by test . I have tried multiple things but no luck. Can anyone please help.
for(ACN_NavigationLibrary.NavigationListItem topicItem : topicsList.Items) {
            ACN_NavigationLibrary.NavigationListItem groupItem = (ACN_NavigationLibrary.NavigationListItem)JSON.deserialize(JSON.serialize(topicItem),ACN_NavigationLibrary.NavigationListItem.class);
            topicItem.IsGroupableItem = true;
            groupItem.Id = topicItem.Name;
            groupItem.Code = topicItem.Name;
            groupItem.GroupName = topicItem.Name;
            groupItem.StyleClassName = 'biib-adu-body-fontsize biib-looking-for-treatment-info-color biib-adu-portal-base-font-family *' ;
            groupItem.NavigationType = 'Event';
            groupItem.NavigationTarget = 'navigationListGroupToggleVisibilityRequested';
            groupItem.NavigationTargetVariable = new Map<String,String>();
            groupItem.SerializedNavigationTargetVariable = '{"navigationItem":{!navigationItem}}';
            //groupItem.IsGroupExpanded = true;
            topicNameList.add(groupItem.GroupName);

            navList.GroupItems.put(groupItem.GroupName, groupItem);
            
            ACN_NavigationLibrary.NavigationRequest articleRequest = (ACN_NavigationLibrary.NavigationRequest)JSON.deserialize(JSON.serialize(request),ACN_NavigationLibrary.NavigationRequest.class);
            articleRequest.Id = topicItem.Name;
            articlesList = articlesProvider.GetNavigationList(articleRequest);
            
            for (ACN_NavigationLibrary.NavigationListItem articleItem : articlesList.Items) {
                ACN_NavigationLibrary.NavigationListItem navItem = (ACN_NavigationLibrary.NavigationListItem)JSON.deserialize(JSON.serialize(articleItem),ACN_NavigationLibrary.NavigationListItem.class);
                navItem.GroupName = groupItem.Name;
                navItem.StyleClassName = 'biib-article-accordion-margin-right biib-margin-left-negetive-7px biib-adu-portal-base-font-family * biib-adu-embedded-link-fontsize biib-font-bold  biib-phone-no-color';
                //navItem.NavigationType = '';
                //navItem.NavigationTarget = '';
                //navItem.NavigationTargetVariables = '';
                navList.Items.add(navItem);
            }
            
        }
Hi  Everyone,
I have a requirement where i need to show logged in user details on community.
User-added image
Here  First name and Last name i will get from logged in user details but other fields are the details of "Address"object that is related to Account and account is related to User(Looged in user.)
How to do that please help.
HI,
How to write test class for the below code. Please help me on this.
 
public class BIIB_ADU_ManageConsent_Controller{
    static Id recordTypeId = BIIB_Utility_Class.getRecordTypeId(BIIB_Adu_Constant.CONSENT_OBJECT, BIIB_Adu_Constant.CONSENT_RECORDTYPE );
    
    /**
* Method Name :     getConsentManagement
* @author:
* @description:     Aura Method to get consent management record 

**/
    @AuraEnabled
    public static List<BIIB_Consent_Management__c> getConsentManagement(){
        //Map<String,BIIB_Consent_Management__c> mapConsent = new Map<String,BIIB_Consent_Management__c>();
        User us = [Select id, accountId from User where Id = :UserInfo.getUserId()];
        List<BIIB_Consent_Management__c> consentList = new List<BIIB_Consent_Management__c>();
        system.debug ('User name' + us);
        ID AccountId = us.accountID;
        System.debug ('account name ' + AccountId );
        consentList= [SELECT ID,BIIB_Consent_Type__c,BIIB_SignatureFirstName__c,BIIB_SignatureLastName__c,BIIB_Status__c,BIIB_Effective_Date__c,CreatedDate 
                      FROM BIIB_Consent_Management__c WHERE 
                      BIIB_Patient_Account__c =: AccountId AND
                      BIIB_Status__c = :BIIB_Adu_Constant.CONSENT_STATUS AND
                      BIIB_Consent_Flag__c = true AND
                      RecordTypeId = :recordTypeId AND
                      (BIIB_Consent_Type__c = :BIIB_Adu_Constant.CONSENT_TYPE_HIPAA OR
                       BIIB_Consent_Type__c = :BIIB_Adu_Constant.CONSENT_TYPE_PATIENTSERVICES) 
                     LIMIT 2];
        
        Map<String,BIIB_Consent_Management__c> mapConsent = new Map<String,BIIB_Consent_Management__c>();
        for(BIIB_Consent_Management__c cm:consentList){
            mapConsent.put(cm.BIIB_Consent_Type__c,cm);
        }
        if(!mapConsent.containsKey(BIIB_Adu_Constant.CONSENT_TYPE_HIPAA)){
            consentList.add(new BIIB_Consent_Management__c(BIIB_Consent_Type__c=BIIB_Adu_Constant.CONSENT_TYPE_HIPAA));
        }
        if(!mapConsent.containsKey(BIIB_Adu_Constant.CONSENT_TYPE_PATIENTSERVICES)){
            consentList.add(new BIIB_Consent_Management__c(BIIB_Consent_Type__c=BIIB_Adu_Constant.CONSENT_TYPE_PATIENTSERVICES));
        }
        return consentList;
    }
    
    
}

 
Hi I have one apex class for which i need to write apex class .please help me in writing the test class below are the code :-
public class BIIB_ADU_ManageConsent_Controller{
    static Id recordTypeId = BIIB_Utility_Class.getRecordTypeId(BIIB_Adu_Constant.CONSENT_OBJECT, BIIB_Adu_Constant.CONSENT_RECORDTYPE );
    
    /**
* Method Name :     getConsentManagement
* @author:
* @description:     Aura Method to get consent management record 

**/
    @AuraEnabled
    public static List<BIIB_Consent_Management__c> getConsentManagement(){
        //Map<String,BIIB_Consent_Management__c> mapConsent = new Map<String,BIIB_Consent_Management__c>();
        User us = [Select id, accountId from User where Id = :UserInfo.getUserId()];
        List<BIIB_Consent_Management__c> consentList = new List<BIIB_Consent_Management__c>();
        system.debug ('User name' + us);
        ID AccountId = us.accountID;
        System.debug ('account name ' + AccountId );
        consentList= [SELECT ID,BIIB_Consent_Type__c,BIIB_SignatureFirstName__c,BIIB_SignatureLastName__c,BIIB_Status__c,BIIB_Effective_Date__c,CreatedDate 
                      FROM BIIB_Consent_Management__c WHERE 
                      BIIB_Patient_Account__c =: AccountId AND
                      BIIB_Status__c = :BIIB_Adu_Constant.CONSENT_STATUS AND
                      BIIB_Consent_Flag__c = true AND
                      RecordTypeId = :recordTypeId AND
                      (BIIB_Consent_Type__c = :BIIB_Adu_Constant.CONSENT_TYPE_HIPAA OR
                       BIIB_Consent_Type__c = :BIIB_Adu_Constant.CONSENT_TYPE_PATIENTSERVICES) 
                     LIMIT 2];
        
        Map<String,BIIB_Consent_Management__c> mapConsent = new Map<String,BIIB_Consent_Management__c>();
        for(BIIB_Consent_Management__c cm:consentList){
            mapConsent.put(cm.BIIB_Consent_Type__c,cm);
        }
        if(!mapConsent.containsKey(BIIB_Adu_Constant.CONSENT_TYPE_HIPAA)){
            consentList.add(new BIIB_Consent_Management__c(BIIB_Consent_Type__c=BIIB_Adu_Constant.CONSENT_TYPE_HIPAA));
        }
        if(!mapConsent.containsKey(BIIB_Adu_Constant.CONSENT_TYPE_PATIENTSERVICES)){
            consentList.add(new BIIB_Consent_Management__c(BIIB_Consent_Type__c=BIIB_Adu_Constant.CONSENT_TYPE_PATIENTSERVICES));
        }
        return consentList;
    }
    
    
}
Need to call a Community's page from my lightning button. How to do that please help.       
button action -  doYourAction

I have created a mockup UI with lightning component.
User-added imagehere i want to show the differnet modals if I click on Share Health info or Patient Service/Marketing. these two are the "Types" of related object(Consent) of Account.

how to pass the attribute of types show that if i click modals will open for the different types.
Please help

I am callling one method of different class from another merhod of different class, called method searches for record  and if not found it will create a record.(both methods are highlighted in bold).

I want if the search method (searches the record in MDM- third party) returns any record then only the create  method (addAccFromGaine) will execute.
Plesae help
/**
* @author: Shubham Sinha
* @date: 02/10/2020
* @description: This class is used for creating User Account and User records when a person tries to Login through Janrain
**/

Public Class BIIB_CreateAccountAndUser_Helper{
    /**
* 
* @description: Wrapper class for User and Account Creation, getting wrapper values from BIIB_ADU_Janrain_AuthProviderHandler Class

**/    
    Public class RegistrationDetails {
        
        public String firstName;
        public String lastName;
        public String fullName;
        public String email;
        public String username;
        public String locale;
        public String provider;
        Public String siteLoginUrl; 
        Public String identifier; 
        Public String link;
        Public Map<String,String> attributeMap;
        
        Public RegistrationDetails(){
            this.firstName ='';
            this.lastName ='';
            this.fullName = '';
            this.email= '';
            this.username = '';
            this.locale = '';
            this.provider ='';
            this.siteLoginUrl= '';
            this.identifier ='';
            this.link = '';
            
        }
    }
    /**
* @author: Shubham Sinha
* @description: Creates User Account and Patient therapy record.

**/
    public Static User createUserAccount(registrationDetails regDetailsWrapObj){
        Product_vod__c prodCatlog = [SELECT Name FROM Product_vod__c WHERE Name = :System.label.BIIB_Product_Aducanumab][0];
        Id recordTypeId = Schema.SObjectType.BIIB_Patient_Therapy__c.getRecordTypeInfosByName().get('Aducanumab').getRecordTypeId();
        Id recordTypeIdAccount = Schema.SObjectType.Account.getRecordTypeInfosByName().get('Patient').getRecordTypeId();
        
        List<Account> checkAccountData = [SELECT id,FirstName, LastName, PersonEmail,BIIB_PASS_Zip_Code__c FROM Account 
                                          WHERE LastName =: regDetailsWrapObj.LastName AND FirstName =:regDetailsWrapObj.FirstName
                                          
                                           Limit 1 ];
        Account createAccount;
        if(checkAccountData.size()> 0)
        {
            createAccount = checkAccountData[0];
            BIIB_Patient_Therapy__c patTherapy = new BIIB_Patient_Therapy__c();
            patTherapy.RecordTypeId = recordTypeId;
            patTherapy.BIIB_Indication__c = System.label.BIIB_Patient_Therapy_Indication;
            patTherapy.BIIB_Therapy__c = prodCatlog.id;
            patTherapy.BIIB_Patient__c= createAccount.id;
            
            insert patTherapy;
        }
        else 
        {
      
           
            createAccount = new Account ();
            createAccount.FirstName= regDetailsWrapObj.firstName;
            createAccount.LastName =regDetailsWrapObj.lastName;
            createAccount.RecordTypeId = recordTypeIdAccount;
            insert createAccount;
 
          BIIB_Patient_Therapy__c accPatTherapy = new BIIB_Patient_Therapy__c();
            accPatTherapy.BIIB_Indication__c = System.label.BIIB_Patient_Therapy_Indication;
            accPatTherapy.BIIB_Therapy__c = prodCatlog.id;
            accPatTherapy.BIIB_Patient__c= createAccount.id;
            insert accPatTherapy;
            
            String searchTermFirst = regDetailsWrapObj.firstname;
            String searchTermLast = regDetailsWrapObj.Lastname;
            String email = regDetailsWrapObj.email;
            
         // Calling the method from SearchPatientController to search the record in MDM

            ApexPages.StandardController accStdControllerObj = new ApexPages.StandardController(new Account());
            SearchPatientController tc = new SearchPatientController(accStdControllerObj);
            tc.getMDMSearchResult( searchTermFirst, searchTermLast, null,null,email,null,null,null,null,null,null,null,null,null); 
          // this method creates the record.
           ApexPages.StandardController accStdControllerOb = new ApexPages.StandardController(new Account());
              SearchPatientController add = new SearchPatientController(accStdControllerOb);
             add.addAccFromGaine(); 
                   }
     
        User aduUser = createAduCommunityUser(regDetailsWrapObj, createAccount.id);
        return aduUser;
    }
}

 
I need to create a lightning page for Community , when a user logs and click a button (that is already developed). It will open a page . with the details of Conset therapy (Custom object with a look up of account).
 there can be two consent types(Type is a custom field of patient therapy) :- 
a) Stare Helath
b) Patient Service.
It has two more custom fields ;
Status and Date.
, so there are three conditions here:- 

1) when the staus is not completed and record is not created(Types of consent) for both the types.
User-added image2) When one type is completed with the data and another is not.
User-added image3) Both records are completed

User-added imageMy Work is not create those records, it will be created by clicking arrow key on the types but that will not handled by me.

If you dont get the explanatation , I can explain more.
Please help on this how to do this
I need to create a left arrow back button and when someone clicks this back button ,it should perform some action. Is there any out of the box functionality of lightning button with left arrow key. Please help me .  Refer the image with the first card.  <        Manage ConsentUser-added image

 
I am calling another method of another class from another class but getting an error 'Method does not exist or incorrect signature: void getMDMSearchResult(String) from the type SearchPatientController' . not sure how to resolve it, Please help.

Parameters of the callled method :

    public List <GaineAcc> getMDMSearchResult(String searchTermFirst,String searchTermLast, String location,String recordTypeString,String email,String phone,Date birthdate,String middleName, String touchId, String hubId, String MDMId,String addstr,String zipCode, String gender){
/**
* @author: Shubham Sinha
* @date: 02/10/2020
* @description: This class is used for creating User Account and User records when a person tries to Login through Janrain
**/

Public Class BIIB_CreateAccountAndUser_Helper{
    /**
* 
* @description: Wrapper class for User and Account Creation, getting wrapper values from BIIB_ADU_Janrain_AuthProviderHandler Class

**/    
    Public class RegistrationDetails {
        
        public String firstName;
        public String lastName;
        public String fullName;
        public String email;
        public String username;
        public String locale;
        public String provider;
        Public String siteLoginUrl; 
        Public String identifier; 
        Public String link;
        Public Map<String,String> attributeMap;
        
        Public RegistrationDetails(){
            this.firstName ='';
            this.lastName ='';
            this.fullName = '';
            this.email= '';
            this.username = '';
            this.locale = '';
            this.provider ='';
            this.siteLoginUrl= '';
            this.identifier ='';
            this.link = '';
            
        }
    }
    /**
* @author: Shubham Sinha
* @description: Creates User Account and Patient therapy record.

**/
    public Static User createUserAccount(registrationDetails regDetailsWrapObj){
        Product_vod__c prodCatlog = [SELECT Name FROM Product_vod__c WHERE Name = :System.label.BIIB_Product_Aducanumab][0];
        Id recordTypeId = Schema.SObjectType.BIIB_Patient_Therapy__c.getRecordTypeInfosByName().get('AD').getRecordTypeId();
        Id recordTypeIdAccount = Schema.SObjectType.Account.getRecordTypeInfosByName().get('Patient').getRecordTypeId();
        
        List<Account> checkAccountData = [SELECT id,FirstName, LastName, PersonEmail,BIIB_PASS_Zip_Code__c FROM Account 
                                          WHERE LastName =: regDetailsWrapObj.LastName AND FirstName =:regDetailsWrapObj.FirstName
                                          AND BIIB_PASS_Zip_Code__c =:  regDetailsWrapObj.attributemap.get('ZIP')
                                           Limit 1 ];
        Account createAccount;
        if(checkAccountData.size()> 0)
        {
            createAccount = checkAccountData[0];
            BIIB_Patient_Therapy__c patTherapy = new BIIB_Patient_Therapy__c();
            patTherapy.RecordTypeId = recordTypeId;
            patTherapy.BIIB_Indication__c = System.label.BIIB_Patient_Therapy_Indication;
            patTherapy.BIIB_Therapy__c = prodCatlog.id;
            patTherapy.BIIB_Patient__c= createAccount.id;
            
            insert patTherapy;
        }
        else 
        {
      
           
            createAccount = new Account ();
            createAccount.FirstName= regDetailsWrapObj.firstName;
            createAccount.LastName =regDetailsWrapObj.lastName;
            createAccount.RecordTypeId = recordTypeIdAccount;
            insert createAccount;
 
          BIIB_Patient_Therapy__c accPatTherapy = new BIIB_Patient_Therapy__c();
            accPatTherapy.BIIB_Indication__c = System.label.BIIB_Patient_Therapy_Indication;
            accPatTherapy.BIIB_Therapy__c = prodCatlog.id;
            accPatTherapy.BIIB_Patient__c= createAccount.id;
            insert accPatTherapy;
                String searchTermFirst = regDetailsWrapObj.firstName;


              ApexPages.StandardController accStdControllerObj = new ApexPages.StandardController(new Account());
            SearchPatientController tc = new SearchPatientController(accStdControllerObj);
            tc.getMDMSearchResult( searchTermFirst); 
        }
     
        User aduUser = createAduCommunityUser(regDetailsWrapObj, createAccount.id);
        return aduUser;
I have a class 'Tabu_Controller' and it has method  getMDMSResult. I have another class "CreateAccount" and merthod name ''CreateUser".
Now i want to use getMDMSResult method in CreateUser method. How to call it.
I have two  objects . Account  and Patient Therapy. I am calling my method from apex class. i have done like this but getting an error 
while calling this method from anonymous method. 

System.DmlException: Insert failed. First exception on row 0; first error: FIELD_FILTER_VALIDATION_EXCEPTION, Value does not exist or does not match filter criteria.: [BIIB_Patient__c]
 
public Static User createUserAccount(registrationDetails regDetailsWrapObj){
        Product_vod__c prodCatlog = [SELECT Name FROM Product_vod__c WHERE Name = :System.label.BIIB_Product_Aducanumab][0];
        
        List<Account> checkAccountData = [SELECT id,FirstName, LastName, PersonEmail,BIIB_PASS_Zip_Code__c FROM Account 
                                          WHERE LastName =: regDetailsWrapObj.LastName 
                                          AND PersonEmail =: regDetailsWrapObj.Email Limit 1 ];
        Account createAccount;
        if(checkAccountData.size()> 0)
        {
            createAccount = checkAccountData[0];
            BIIB_Patient_Therapy__c patTherapy = new BIIB_Patient_Therapy__c();
            patTherapy.BIIB_Indication__c = System.label.BIIB_Patient_Therapy_Indication;
            patTherapy.BIIB_Therapy__c = prodCatlog.Id;
            patTherapy.BIIB_Patient__c= createAccount.id;
            
            insert patTherapy;
        }
        else 
        {
           
            createAccount = new Account ();
            createAccount.FirstName= regDetailsWrapObj.firstName;
            createAccount.LastName =regDetailsWrapObj.lastName;
            insert createAccount;
 
          BIIB_Patient_Therapy__c accPatTherapy = new BIIB_Patient_Therapy__c();
            accPatTherapy.BIIB_Indication__c = System.label.BIIB_Patient_Therapy_Indication;
            accPatTherapy.BIIB_Therapy__c = prodCatlog.id;
            accPatTherapy.BIIB_Patient__c= createAccount.id;
            insert accPatTherapy;

            
        }

 
I have a class on which i need to call 'createUserAccount' method but how to set parameter for this method in anonymous window , I do not know please help on this
/**
* @author: Shubham Sinha
* @date: 02/10/2020
* @description: This class is used for creating User Account and User records when a person tries to Login through Janrain
**/

Public Class BIIB_CreateAccountAndUser_Helper{
    /**
* 
* @description: Wrapper class for User and Account Creation, getting wrapper values from BIIB_ADU_Janrain_AuthProviderHandler Class

**/    
    Public class registrationDetails {
        
        public String firstName;
        public String lastName;
        public String fullName;
        public String email;
        public String username;
        public String locale;
        public String provider;
        Public String siteLoginUrl; 
        Public String identifier; 
        Public String link;
        Public Map<String,String> attributeMap;
        
       
    }
    
    /**
* @author: Shubham Sinha
* @description: Creates User Account and Patient therapy record.

**/
    public Static User createUserAccount(registrationDetails regDetailsWrapObj){
        Product_vod__c prodCatlog = [SELECT Name FROM Product_vod__c WHERE Name = :System.label.BIIB_Product_Aducanumab];
        Id recordTypeId = Schema.SObjectType.BIIB_Patient_Therapy__c.getRecordTypeInfosByName().get('BIIB_AD').getRecordTypeId();
        Id recordTypeIdAccount = Schema.SObjectType.Account.getRecordTypeInfosByName().get('BIIB_Patient').getRecordTypeId();
        
        List<Account> checkAccountData = [SELECT id,FirstName, LastName, PersonEmail,BIIB_PASS_Zip_Code__c FROM Account 
                                          WHERE LastName =: regDetailsWrapObj.LastName AND BIIB_PASS_Zip_Code__c =: regDetailsWrapObj.attributemap.get('ZIP')
                                          AND PersonEmail =: regDetailsWrapObj.Email Limit 1 ];
        Account createAccount;
        if(checkAccountData.size()> 0)
        {
            createAccount = checkAccountData[0];
            BIIB_Patient_Therapy__c patTherapy = new BIIB_Patient_Therapy__c();
            patTherapy.RecordTypeId = recordTypeId;
            patTherapy.BIIB_Indication__c = System.label.BIIB_Patient_Therapy_Indication;
            patTherapy.BIIB_Therapy__c = prodCatlog.Name;
            patTherapy.BIIB_Patient__c= createAccount.id;
            
            insert patTherapy;
        }
        else 
        {
           
            createAccount = new Account ();
            createAccount.FirstName= regDetailsWrapObj.firstName;
            createAccount.LastName =regDetailsWrapObj.lastName;
            createAccount.RecordTypeId = recordTypeIdAccount;
            insert createAccount;
 
          BIIB_Patient_Therapy__c accPatTherapy = new BIIB_Patient_Therapy__c();
            accPatTherapy.BIIB_Indication__c = System.label.BIIB_Patient_Therapy_Indication;
            accPatTherapy.BIIB_Therapy__c = prodCatlog.Name;
            accPatTherapy.BIIB_Patient__c= createAccount.id;
            insert accPatTherapy;

            
        }
        User aduUser = createAduCommunityUser(regDetailsWrapObj, createAccount.id);
        return aduUser;
    }
    
    public Static User createAduCommunityUser(registrationDetails regDetailsWrapObj, Id accountId){
        //create community user with related account id
        User aduUser = new User();
        aduUser.contactId = accountId;
        return aduUser;
    }
    
}
I need to write a class which creates and updates the Account object. Criterias are first it will search the existing record in the database if the Last Name and ZIP code fields of the record do not match, Creates the Account record and if matches then updates the existing record . Updating field would be "Related".
How to do this. Please help
Hi, 
How to write a test class for below code
public class AccountSelectClassController{

    

//Our collection of the class/wrapper objects wrapAccount 
    public List<wrapContact> wrapContactList {get; set;}
    public List<contact> selectedcontacts{get;set;}
    public string searchtext1{get;set;}
     
    public void search(){
        if(wrapContactList == null) {
            wrapContactList = new List<wrapContact>();
            for(Contact a: [select Id, name, Phone from contact where lastname like :searchtext1 ]) {
                // As each Account is processed we create a new wrapAccount object and add it to the wrapAccountList
                wrapContactList.add(new wrapContact(a));
            }
        }
    }
 
    public void processSelected() {
    selectedcontacts = new List<contact>();
 
        for(wrapContact wrapContactObj : wrapContactList) {
            if(wrapContactObj.selected == true) {
                selectedcontacts.add(wrapContactObj.con);
            }
        }
    }
 public void clear() {
        wrapContactList.clear();
    }
 
    // This is our wrapper/container class. A container class is a class, a data structure, or an abstract data type whose instances are collections of other objects. In this example a wrapper class contains both the standard salesforce object Account and a Boolean value
    public class wrapContact {
        public contact con {get; set;}
        public Boolean selected {get; set;}
 
        //This is the contructor method. When we create a new wrapAccount object we pass a Account that is set to the acc property. We also set the selected value to false
        public wrapContact(contact a) {
            con = a;
            selected = false;
        }
    }
}
I have a requirement where i need to create a VF that takes  last name as input and search for the contacts .Results should be displayed as selectable records with checkboxes.User should be able to select the results and should display the selected results upon hitting the See Results button below the record.

Please help me on that

Hi,
I have a requirement where a object Collection__c has a picklist field 'Product__c',  and one look up field 'Location'.Collection has a related record 'Product Required'. When a Collection__c record is created - Product required and location automatically created through our logic. 
Location itself a Standard object and it has a related record 'Product Item'. We have Manually updated 'Product items' on each Locations.

So now requirement is if "Product Required" on Collection__c and "Product Item" on Location(Populated on collection__c object) matches then Picklist field "Product__c" updated to 'In Stock' and if not then 'Out Of Stock'.

I know it is bit complicated to understand but if  anyone can help on this please.

Hi,
I am new to Salesforce . I need to write a test class for custom controller. 
Please help me
public class UpdateGoogleApiController {

    public string endpoint{get; set;}

    //Insert the new custom setting record in the database
    public void saveRecord(){
        CREDE__GoogleAPIEndPoint__c googleKey  = [SELECT Id, name from CREDE__GoogleAPIEndPoint__c][0];
       CREDE__GoogleAPIEndPoint__c gAPI  = new CREDE__GoogleAPIEndPoint__c();
        gAPI.Id = googleKey.Id; 
        gAPI.CREDE__EndpointURL__c = endpoint;
       
        Update gAPI;
    ApexPages.AddMessage(new ApexPages.Message(ApexPages.Severity.CONFIRM,'API key value is updated Successfully.Thank you!'));
        //Redirect to new record detail page
      // return new PageReference('/' + googleKey.Id);
      // return null;
    }
}

 
I am callling one method of different class from another merhod of different class, called method searches for record  and if not found it will create a record.(both methods are highlighted in bold).

I want if the search method (searches the record in MDM- third party) returns any record then only the create  method (addAccFromGaine) will execute.
Plesae help
/**
* @author: Shubham Sinha
* @date: 02/10/2020
* @description: This class is used for creating User Account and User records when a person tries to Login through Janrain
**/

Public Class BIIB_CreateAccountAndUser_Helper{
    /**
* 
* @description: Wrapper class for User and Account Creation, getting wrapper values from BIIB_ADU_Janrain_AuthProviderHandler Class

**/    
    Public class RegistrationDetails {
        
        public String firstName;
        public String lastName;
        public String fullName;
        public String email;
        public String username;
        public String locale;
        public String provider;
        Public String siteLoginUrl; 
        Public String identifier; 
        Public String link;
        Public Map<String,String> attributeMap;
        
        Public RegistrationDetails(){
            this.firstName ='';
            this.lastName ='';
            this.fullName = '';
            this.email= '';
            this.username = '';
            this.locale = '';
            this.provider ='';
            this.siteLoginUrl= '';
            this.identifier ='';
            this.link = '';
            
        }
    }
    /**
* @author: Shubham Sinha
* @description: Creates User Account and Patient therapy record.

**/
    public Static User createUserAccount(registrationDetails regDetailsWrapObj){
        Product_vod__c prodCatlog = [SELECT Name FROM Product_vod__c WHERE Name = :System.label.BIIB_Product_Aducanumab][0];
        Id recordTypeId = Schema.SObjectType.BIIB_Patient_Therapy__c.getRecordTypeInfosByName().get('Aducanumab').getRecordTypeId();
        Id recordTypeIdAccount = Schema.SObjectType.Account.getRecordTypeInfosByName().get('Patient').getRecordTypeId();
        
        List<Account> checkAccountData = [SELECT id,FirstName, LastName, PersonEmail,BIIB_PASS_Zip_Code__c FROM Account 
                                          WHERE LastName =: regDetailsWrapObj.LastName AND FirstName =:regDetailsWrapObj.FirstName
                                          
                                           Limit 1 ];
        Account createAccount;
        if(checkAccountData.size()> 0)
        {
            createAccount = checkAccountData[0];
            BIIB_Patient_Therapy__c patTherapy = new BIIB_Patient_Therapy__c();
            patTherapy.RecordTypeId = recordTypeId;
            patTherapy.BIIB_Indication__c = System.label.BIIB_Patient_Therapy_Indication;
            patTherapy.BIIB_Therapy__c = prodCatlog.id;
            patTherapy.BIIB_Patient__c= createAccount.id;
            
            insert patTherapy;
        }
        else 
        {
      
           
            createAccount = new Account ();
            createAccount.FirstName= regDetailsWrapObj.firstName;
            createAccount.LastName =regDetailsWrapObj.lastName;
            createAccount.RecordTypeId = recordTypeIdAccount;
            insert createAccount;
 
          BIIB_Patient_Therapy__c accPatTherapy = new BIIB_Patient_Therapy__c();
            accPatTherapy.BIIB_Indication__c = System.label.BIIB_Patient_Therapy_Indication;
            accPatTherapy.BIIB_Therapy__c = prodCatlog.id;
            accPatTherapy.BIIB_Patient__c= createAccount.id;
            insert accPatTherapy;
            
            String searchTermFirst = regDetailsWrapObj.firstname;
            String searchTermLast = regDetailsWrapObj.Lastname;
            String email = regDetailsWrapObj.email;
            
         // Calling the method from SearchPatientController to search the record in MDM

            ApexPages.StandardController accStdControllerObj = new ApexPages.StandardController(new Account());
            SearchPatientController tc = new SearchPatientController(accStdControllerObj);
            tc.getMDMSearchResult( searchTermFirst, searchTermLast, null,null,email,null,null,null,null,null,null,null,null,null); 
          // this method creates the record.
           ApexPages.StandardController accStdControllerOb = new ApexPages.StandardController(new Account());
              SearchPatientController add = new SearchPatientController(accStdControllerOb);
             add.addAccFromGaine(); 
                   }
     
        User aduUser = createAduCommunityUser(regDetailsWrapObj, createAccount.id);
        return aduUser;
    }
}

 
I need to write a class which creates and updates the Account object. Criterias are first it will search the existing record in the database if the Last Name and ZIP code fields of the record do not match, Creates the Account record and if matches then updates the existing record . Updating field would be "Related".
How to do this. Please help
Hi, 
How to write a test class for below code
public class AccountSelectClassController{

    

//Our collection of the class/wrapper objects wrapAccount 
    public List<wrapContact> wrapContactList {get; set;}
    public List<contact> selectedcontacts{get;set;}
    public string searchtext1{get;set;}
     
    public void search(){
        if(wrapContactList == null) {
            wrapContactList = new List<wrapContact>();
            for(Contact a: [select Id, name, Phone from contact where lastname like :searchtext1 ]) {
                // As each Account is processed we create a new wrapAccount object and add it to the wrapAccountList
                wrapContactList.add(new wrapContact(a));
            }
        }
    }
 
    public void processSelected() {
    selectedcontacts = new List<contact>();
 
        for(wrapContact wrapContactObj : wrapContactList) {
            if(wrapContactObj.selected == true) {
                selectedcontacts.add(wrapContactObj.con);
            }
        }
    }
 public void clear() {
        wrapContactList.clear();
    }
 
    // This is our wrapper/container class. A container class is a class, a data structure, or an abstract data type whose instances are collections of other objects. In this example a wrapper class contains both the standard salesforce object Account and a Boolean value
    public class wrapContact {
        public contact con {get; set;}
        public Boolean selected {get; set;}
 
        //This is the contructor method. When we create a new wrapAccount object we pass a Account that is set to the acc property. We also set the selected value to false
        public wrapContact(contact a) {
            con = a;
            selected = false;
        }
    }
}
I have a requirement where i need to create a VF that takes  last name as input and search for the contacts .Results should be displayed as selectable records with checkboxes.User should be able to select the results and should display the selected results upon hitting the See Results button below the record.

Please help me on that