• Pankaj P
  • NEWBIE
  • 120 Points
  • Member since 2015
  • Salesforce Technical Lead
  • Eternus Solution Pvt. Ltd.

  • Chatter
    Feed
  • 4
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 1
    Questions
  • 40
    Replies
Hello,

I have a user with a profile.
I want to make changes in FLS only for this user.

how can i implement it ?
Hi all,

I have not worked with process builder so much to figure out the following (if that is even in power of PB). I would like to allow users to move to stage Approval on Opportunities only if CSR checkbox is True, as one exmaple. For other stage - Negotiation - users cannot move further (to stage Review) if related record - contract - is not associated with Opportunity. The very first confusing thing is what action to choose in PB as a start. In addition, an error message would be required, so the user knows why he/she cannot move ahead. Any advice appreciated. Thank you.

Regards,
Ilv
  • November 02, 2017
  • Like
  • 0
Hello;
i have a developer edition account  and i am not able to connect to salesforce using eclipse i did  google the problem and i tried all the solution but none of them worked for me.
Note :
My User is already active and the user have an System administrator Profile and i dit force the ip range in Network Access.

so when i try to connect to Production/Developer Edition i get the error below :
User-added image
and when i try to connect to the sandbox environment i get the error below :
User-added image
i tried to access to test.salesforce.com directly from the navigateur and i get "username or password invalid"
and when i try to reset my password by clicking password forgoten i get nothing in my mail.
Could you please help me ??
Thank you in advance.
hi all i have a trigger that gains 100% coverage with unit test class in sandbox but fails on validation while trying to deploy to production

the validation error

User-added image

heres class
 
@istest
public class contactTriggerTest{

private static Contact ct;

@testsetup
static void createContact(){
    ct = new Contact(FirstName = 'Iain',LastName = 'Banks');
    insert ct;
}

private static testmethod void testReassignUsers(){
    createContact();
    Test.startTest();
        Contact thisCt = [select id, Allocated_User__c, FirstName from Contact where Id =:ct.id];
        system.assert(thisCt.Allocated_User__c != null);
        
        //update a different field shouldnt change the Allocated_User__c
        thisCt.FirstName = 'Steve';
        update thisCt;
        Contact thisCt2 = [select id, Allocated_User__c, FirstName from Contact where Id =:ct.id];
        system.assert(thisCt2.Allocated_User__c == thisCt2.Allocated_User__c);
        
        //update Allocated_User__c to null should reassign Allocated_User__c 
        thisCt2.Allocated_User__c =  null;
        update thisCt2;
        thisCt = [select id, Allocated_User__c, FirstName from Contact where Id =:ct.id];
        system.assert(thisCt.Allocated_User__c != null);
    Test.stopTest();
}

}

here's trigger
trigger popallocateduser on Contact ( before insert,before update) {

 //unittest called contactTriggerTest

Set<String> roleNames = new Set<String>();

roleNames.add('Listers');
    //lister roleid

List<User> userList = [select id from User where isActive = true  and userrole.name in :roleNames];
if(userList.size() > 0){
    for(Contact con : trigger.new){
        if(con.Allocated_User__c == null){
            integer randomIntInRange = Math.round(Math.random() * userList.size()); 
            
con.Allocated_User__c = userList [(randomIntInRange > 0) ? randomIntInRange - 1 : randomIntInRange].id;
        }
    }

}

}


 
I am struggling to find a way to check if my current logged in user is present in Intial Submitters list in an approval process for object xyz so that on my custom visual force page (which allows to submit the records for approval) I can hide the Submit for approval button and show a friendly message to user that they cannot submit. 
Salesforce shows quite ugly message : 
User-added image
I got to know that ProcessDefinition (https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_processdefinition.htm?search_text=approval) id the object that holds information about individual approval process but does not contain initial submitters or more information. 

Is that possible to fetch in Apex code? any other way?

Much appreciate your time and any of your inputs on this :)
I'm getting the following error while deploying the case page layout to another org vi Copado.
Deployment Error:

[QuickAction Case.Custom_Email] Send Email is disabled or activities are not allowed. Enable Send Email and allow activities, then try again.[Layout Case-Billing Line Item Adjustment] In field: QuickAction - no QuickAction named Case.Custom_Email found

In target org I did the "No Access" for Deliverability under the Email Administration and tried to deploy the page layout still getting the same error.
Kindly please help me out.
Hello,

Need some suggestions regarding cpq quote template customization

I want to create a quote template similar to the below screen in cpq using Quote Template Object from cpq package.
Can anybody suggest that how can I achieve this.

User-added image

In the screenshot, we can see there are three sections.  those are Product features from the product bundle. I want to display data by feature wise.
I think this can be done with vf page but I don't have any idea that how can refer vf page in Quote Template.Can anybody suggest regarding this..?
Will it be done by creating one vf page OR Do I need to create multiple for each section if yes then how can we refer them in CPQ quote template.



Welcome to your suggetsions!

Thanks,
Nilesh
Hello All,


I have created a Prodct rule in salesforce CPQ. Criteria is when the 'CAD-CLIENT-FT' or 'CAD-CLIENT PT' products is selected while creating quote
'CAD-SERVERSW' must be included on the quote.
I have created below rule to fulfill the requirement:
1.Product Rule
Product Rule

2. Product Action
Product Action

3. Product Configuration:
Product Configuration

Letter on I am creating Quote with the mentioned two products but the product is not getting added to the Quote even meets the criteria
My rule is not triggering. Can anybody help in this if missing something.

Welcome to your suggestions!

Thanks
Nilesh
Hi,

Document says:
Methods defined with the @testSetup annotation are used for creating common test records that are available for all test methods in the class.

I am confused that the class means all test classes in org or only the test class which contains @testSetup if I run all test classes.

I didn't find the details.
Anyone can explain this to me?

Thanks.
Ying
I want to update Account.Name with ( FirstName__C + LastName__C) whenever FirstName__C or LastName__C is changed or new account is created.

Workflow/process builder/trigger will not work as it will work when event is raised and Account.Name is mandatory field. Any suggestion. 

Getting the following error when I m trying to create a MAP out of Account object.
There are many Accounts in the ORG but I need to get and Map of all so cross check a condition on trigger and update few accounts based on the conditions..

But I need to get the accounts MAP first to get the existing Account records, is there a way to get all the accounts

Sharing the code below...

Requesting please let me how to proceed with this..

 

public with sharing class AccountReleationShipTriggerHandler {    
    public static void getAccountFromTrigger(List<Account_Relationships__c>  lstAccountRelation)
    {        
        System.debug('>>>>>>> lstAccountRelation : '+lstAccountRelation.size());
        ID rtId = [SELECT Id FROM RecordType WHERE SobjectType='Account' and developerName='Site'].id;        
        Map<ID, Account> allAccountMap = new Map<ID, Account>([SELECT Id, Name, Portfolio_Type__c, Source_Zone__c, RecordTypeID FROM Account]);        

        for (Account_Relationships__c ar : lstAccountRelation)
        {
            // will perform the operations here... 
            // As here I need to refer the MAP to find the account details and update
..
            System.debug('test ar Source_Account__c : '+ ar.Source_Account__c);
            System.debug('test ar Related_Account__c : '+ ar.Related_Account__c);
            System.debug('test ar Type__c : '+ ar.Type__c);        
        }         
   }    
}

 

Getting following error : 

Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger trig_AccountUpdate caused an unexpected exception, contact your administrator: trig_AccountUpdate: execution of AfterInsert caused by: System.QueryException: Non-selective query against large object type (more than 200000 rows). Consider an indexed filter or contact salesforce.com about custom indexing. Even if a field is indexed a filter might still not be selective when: 1. The filter value includes null (for instance binding with a list that contains null) 2. Data skew exists whereby the number of matching rows is very large (for instance, filtering for a particular foreign key value that occurs many times): Class.AccountReleationShipTriggerHandler.getAccountFromTrigger: line 6, column 1

Hello guys,

I am trying to use 3rd party apis in salesforce.
i am very new to these integrtions stuff.

3rd prty provided their code. Now how to use that.
Do i need to create clss or how to do?
Please give me example.

Thanks
 
can we perform dml on wrapper class list?
 i want to perform upsert operation on wrapper class list.
wrapper class dispaly two object data on vf and also able to enter data in one object on vf. n now i have to perform upsert operation on this list.
Hello,

I have a user with a profile.
I want to make changes in FLS only for this user.

how can i implement it ?
Hi All,
I have written the Apex class for coping all feeditem of lead to converted account and Contact.
The code is working fine but it will not work for above 200 records because I have queried feeditem inside the loop.
for(Lead l:ledlst)
    {
        for(List<feeditem> flst:[Select ParentId,Id, Body,IsRichText From FeedItem Where ParentId =: l.id])
        {
          feedMap.put(l.Id, flst); 
        }
    }
As am new to salesforce I not getting how to optimize this code.
Please help me to write code with best practice.
Entire Class Code:
public class Lead_Convert_Handler 
{
 public void addLeadfeedToAccCont(list<Lead> ledlst)
  {
    list<feedItem> conFeeditm = new list<feedItem>();
    list<feedItem> accFeeditm = new list<feedItem>();    
    Map<Id,list<FeedItem>> feedMap = new Map<Id,list<FeedItem>>();    
    Map<Id,Id> acctIdMap = new Map<Id,Id>();
    Map<Id,Id> contIdMap = new Map<Id,Id>();  
    // add feeditem related to lead to FeedMap  
    for(Lead l:ledlst)
    {
        for(List<feeditem> flst:[Select ParentId,Id, Body,IsRichText From FeedItem Where ParentId =: l.id])
        {
          feedMap.put(l.Id, flst); 
        }
    }
   // loop to add converted acc and cont id to map.   
    for(lead l:ledlst)
    {
      acctIdMap.put(l.id, l.ConvertedAccountId);
      contIdMap.put(l.id, l.ConvertedContactId);  
    }
    system.debug(feedMap);  
    // Copy feeditem from lead to converted contact and account.  
    for(lead l1:ledlst)
    {
        if(!feedMap.isEmpty())
        {
            //for(Id pid:feedMap.keySet())
            //{
            for(feedItem lf:feedMap.get(l1.id))
             {
              if(feedMap.containsKey(l1.Id)&&acctIdMap.containsKey(l1.Id)&&contIdMap.containsKey(l1.Id)&&lf.ParentId == l1.Id) 
                {
                  // create feed for Account  
                  FeedItem accfeed = new FeedItem();
                  accfeed.Body = lf.Body;
                  accfeed.ParentId = acctIdMap.get(l1.Id);
                  accFeeditm.add(accfeed);
                // create feed for Contact
                 FeedItem confeed = new FeedItem();
                 confeed.Body = lf.Body;
                 confeed.ParentId =contIdMap.get(l1.Id);
                 conFeeditm.add(confeed);          
                }
              }
          //  }
        } 
    }
    IF(!accFeeditm.isEmpty())
    insert accFeeditm;
    IF(!conFeeditm.isEmpty())
    insert conFeeditm;   
  }
}

Thanks In advance
global class Edgeforce {
  global class searchResult
    {
        string thumbnail = '';
        string title = '';
        string description = '';
        string link = '';
        integer size = 0;
        string type = '';
        id recordId;
        sObject objectData;
        String startDate = '';
    }
    
        //By this field Tab would be selected on intranetPages 
    global static String tabName {get; set;}
    //This map is used to identified top level parent of CMS pages.
    global static map<String, String> parentTabMap {get;set;}
    //By this field category limit will be decided on each object. 
    global static final Integer categoryLimit {get;set;}
    //By this field no of records will be decided to show on Search page 
    global static final Integer paginationLimit {get; set;}
    //Key prefix of Intranet_Article__c object
    private static final String IntranetArticleKeyPrefix {get; set;}
    static Map<String, String> contentNameTitleMap;
    static Map<String, String> parentTabNameMap;
    static Map<SObject, Intranet_Content__c> versionContentMap = new Map<SObject, Intranet_Content__c>();
    static {
            //Initialize final varibles to decide search configuration
            for(Intranet_content__c searchConfig : [Select Name, value__c From Intranet_content__c where recordType.Name = 'Config - Portal']) {
            if(searchConfig.Name == 'Search Limit') {
                categoryLimit = Integer.valueOf(searchConfig.value__c);
            }
            if(searchConfig.Name == 'Search Pagination') {
                paginationLimit = Integer.valueOf(searchConfig.value__c);
            }           
        }
        IntranetArticleKeyPrefix = Schema.getGlobalDescribe().get('Intranet_Content_Version__c').getDescribe().getKeyPrefix();
    }
     
    /*remote method to be accessed via javascript for performing a search.
      arguments
          searchTerm: a string at least two characters long (not including wildcards) to search for
          objectList: a list/array of sObject names which to query for
          objectLabels: a map/javascript object of sObject names to a friendly label to use in the result. Multiple sObjects can have the same label and will be returned in the same group.
          typeLimit: a maxmimum amount of each kind of object to find. This is per sObject type, not per label or for the total search.  
    */ 
    @RemoteAction
    global static map<string,list<searchResult>> globalSearch(string searchTerm,boolean isMobile,list<string>objectList,map<string,string> objectLabels, integer typeLimit)
    {
        //map to hold the results. The results will have the objectLabels or names (if no label for that object type is provided) and a list of search results for it.
        map<string,list<searchResult>> results = new  map<string,list<searchResult>>();
        map<String, boolean> isIncludedInSearchMap = new map<String,Boolean>();
        parentTabMap = new map<String,String>();
        try
        { 
            string customObjectQuery = '';
            objectLabels = new map<string,string>();
           for(Intranet_Content__c searchConfig : [Select name,Object_Name__c,Display_In_Search__c From Intranet_Content__c Where RecordType.Name='Config - Search']) {
                isIncludedInSearchMap.put(searchConfig.Object_Name__c, searchConfig.Display_In_Search__c);
                objectLabels.put(searchConfig.Object_Name__c, searchConfig.Name);
            }
            
            String userLang = '';
            for(Intranet_content__c searchConfig : [Select Name, value__c From Intranet_content__c where recordType.Name = 'Config - Portal' AND name =: userinfo.getLanguage()]){
                if(searchConfig  != null){
                  userLang = searchConfig.Value__c;
                }
            }
            
            for(string obj : objectList)
            {
                if(obj == 'Intranet_Content_Version__c' && isIncludedInSearchMap.get(obj) == true) {
                    customObjectQuery += 'Intranet_Content_Version__c' +'(Name,Id,Language__c,Intranet_Content__c,Summary__c WHERE isPublished__c = true order by LastModifiedDate DESC LIMIT '+typeLimit+'),';
                }/*else if(obj == 'Intranet_CMS_Page__c' && isIncludedInSearchMap.get(obj) == true) {
                    customObjectQuery += 'Intranet_Content_Version__c'+'(Name,Id,Intranet_Content__c,Intranet_Content__r.Template__c,Intranet_Content__r.Skip_Menu_Link__c,Intranet_Content__r.URL__c,Intranet_Content__r.createdById,Intranet_Content__r.CreatedDate WHERE Intranet_Content__r.Status__c = \'Published\' AND Intranet_Content__r.RecordType.Name = \'Intranet CMS Pages\' order by Name LIMIT '+typeLimit+'),';
                }*/else if(obj == 'FeedItem' && isIncludedInSearchMap.get(obj) == true) {
                    customObjectQuery += obj+'(id, title, body, InsertedBy.Name, InsertedById, CreatedDate, ParentId order by CreatedDate DESC LIMIT '+typeLimit+'),';
                }else if(obj == 'ContentVersion' && isIncludedInSearchMap.get(obj) == true) {
                    customObjectQuery += obj+'(ContentDocumentId,ContentSize,ContentUrl,Description,IsLatest,PublishStatus,TagCsv,Title,FileType,Id order by RatingCount DESC LIMIT '+typeLimit+'),';
                }else if(obj == 'User' && isIncludedInSearchMap.get(obj) == true) {
                    customObjectQuery += obj+'(id, name, SmallPhotoUrl, email order by Name LIMIT '+typeLimit+'),';
                }else if(isIncludedInSearchMap.get(obj) == true){
                    customObjectQuery += obj+'(Name,Id,createdById,CreatedDate LIMIT '+typeLimit+'),';                
                }
            }
            
            system.debug(customObjectQuery);
            string objectsQuery = 'FIND \''+searchTerm+'\' IN ALL FIELDS RETURNING '+customObjectQuery.subString(0, customObjectQuery.length()-1);
            
            System.debug('debug objectsQuery >> ' + objectsQuery);
            List<List<SObject>> tempSearchList = search.query(objectsQuery);
            string objType = '';
            string objLabel = '';
            
            Map<ID,SObject>  contentVersionMap;
            List<List<SObject>> searchList = new List<List<SObject>>();
            List<SObject> sobjList;
            Set<ID> contentIdSet;
            boolean isContent;
            Map<ID, List<Intranet_Content_Version__c>> mapContContVersion;
            for(List<sObject> thisObjList : tempSearchList){
                sobjList= new List<SObject>();
                contentVersionMap = new Map<ID, SObject>();
                contentIdSet = new Set<ID>();
                mapContContVersion = new Map<ID, List<Intranet_Content_Version__c>>();
                isContent = false;
                for(sObject thisObj : thisObjList){
                  if(string.valueOf(thisObj.getsObjectType()) == 'Intranet_Content_Version__c'){
                     isContent = true;
                     //Added by Sidhant Agarwal T-331988
                     if(!mapContContVersion.containsKey((string)thisObj.get('Intranet_Content__c'))) {
                         mapContContVersion.put((string)thisObj.get('Intranet_Content__c'), new List<Intranet_Content_Version__c>());
                     }
                     mapContContVersion.get((string)thisObj.get('Intranet_Content__c')).add((Intranet_Content_Version__c)thisObj);
                    
                  }else{
                    sobjList.add(thisObj);
                  }
                }
                if(isContent){
                    for(String contentId : mapContContVersion.keyset()){
                      
                      for(Intranet_Content_Version__c icv : mapContContVersion.get(contentId)){
                          sobjList.add(icv);
                      }
                    }
                }
                searchList.add(sobjList);
            }
           
Hi All,
I want pagination functionality for wrapper list which dynamically showing results based search text.
Here is my code
01<apex:page controller="CategorySearchController"> 
02 <apex:form >
03        <apex:pageBlock >
04 
05            <apex:pageBlockButtons >
06                <apex:commandButton action="{!back}" value="Back"/>
07            </apex:pageBlockButtons>
08            <apex:pageMessages />
09 
10            <apex:pageBlockSection title="You Selected" columns="1">
11                <apex:pageBlockTable value="{!selectedCategories}" var="c">
12                    <apex:column value="{!c.cat.Name}"/>
13                </apex:pageBlockTable>
14            </apex:pageBlockSection>          
15 
16        </apex:pageBlock>
17    </apex:form>
18</apex:page>
controller class
 
01public class CategorySearchController {
02 
03    // the results from the search. do not init the results or a blank rows show up initially on page load
04    public List<categoryWrapper> searchResults {get;set;}
05    // the categories that were checked/selected.
06    public List<categoryWrapper> selectedCategories {
07        get {
08            if (selectedCategories == null) selectedCategories = new List<categoryWrapper>();
09            return selectedCategories;
10        }
11        set;
12    }     
13 
14    // the text in the search box
15    public string searchText {
16        get {
17            if (searchText == null) searchText = 'acc'; // prefill the serach box for ease of use
18            return searchText;
19        }
20        set;
21    }
22 
23    // constructor
24    public CategorySearchController() {}
25 
26    // fired when the search button is clicked
27    public PageReference search() {
28 
29        if (searchResults == null) {
30            searchResults = new List<categoryWrapper>(); // init the list if it is null
31        } else {
32            searchResults.clear(); // clear out the current results if they exist
33        }
34        // Note: you could have achieved the same results as above by just using:
35        // searchResults = new List<categoryWrapper>();
36 
37        // dynamic soql
38        String qry = 'Select c.Name, c.Id From account c Where c.Name LIKE \'%'+searchText+'%\' Order By c.Name';
39         
40        for(account c : Database.query(qry)) {
41            //new wrapper by passing it the category in the constructor
42            CategoryWrapper cw = new CategoryWrapper(c);
43            // wrapper to the results
44            searchResults.add(cw);
45        }
46        return null;
47    }  
48 
49    public PageReference next() {
50 
51        // clear out the currently selected categories
52        selectedCategories.clear();
53 
54        // add the selected categories to a new List
55        for (CategoryWrapper cw : searchResults) {
56            if (cw.checked)
57                selectedCategories.add(new CategoryWrapper(cw.cat));
58        }
59 
60        // ensure they selected at least one category or show an error message.
61        if (selectedCategories.size() > 0) {
62            return Page.Category_Results;
63        } else {
64            ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Please select at least one Category.'));
65            return null;
66        }      
67 
68    }      
69 
70    // fired when the back button is clicked
71    public PageReference back() {
72        return Page.Category_Search;
73    }      
74 
75}
01public class CategoryWrapper {
02 
03    public Boolean checked{ get; set; }
04    public account cat { get; set;}
05 
06    public CategoryWrapper(){
07        cat = new account ();
08        checked = false;
09    }
10 
11    public CategoryWrapper(account c){
12        cat = c;
13        checked = false;
14    }
15 
16    
17 
18}
I want pagination for the records which are showing in dynamic wrapper list.
Please help me. Its urgent
Thanks in Advance
I'm displaying the list of account record on VF page in pageblocktable. Account record will be inline edit on Vf page. Now I've to display the list of realted contact on account record on mouseover/click, In such a way that User can quickly review(read only) the contact without scrolling up/down.
So need a contact list should be visible on mosuseover. Is it possible? or other option.

we can display the realted list of contact below to all account record but in this case user has to scroll down. This it is not satisfy my requirement.
Hi,

We have a profile which we don't want to grant create permission to it. since we don't want them to use New button in the object tab to create record. instead , they should click some detail button which will open VF page, and then create record from there. since the apex is running in system mode, we thought it should work. but I keep having problem. in the VF Page controller's constructor, we create a custom object new instance. and in the VF page, we want to display fields by using <apex:inputfield > tab. but none of the field is shown up. we have tried the standard controller extension and custom controller. none of them working. Any suggestions?

Thanks,
All my users have access to post notes and attachments on a custom object except one and I cannot figure out what permission set is off.
I recently got Data Loader 39 and was trying to update settings for updating nulls.  I can't seem to save the settings.  I scroll to bottom of settings the screen won't go to the end and can't save.  I'm I missing a step?


User-added image

Hello,

 

I have a visualforce page with a command Button. When this is pressed some work is done in the page-reference of the controller-extension. During this work it is sometimes necessary to open new Windows in which are PDF-Documents are generated and diplayed. Is it possible to open a second, third, forth ... window with a visualforce page rendered as PDF directly from the apex code without leaving the original window. In the pagereference I think, I can only pass one new page, which is then displayed in the actual window, but I want to stay on this window with the original content and open the others for the user, who can then print them?

 

Thanks

Harry

When someone takes the time/effort to repspond to your question, you should take the time/effort to either mark the question as "Solved", or post a Follow-Up with addtional information.  

 

That way people with a similar question can find the Solution without having to re-post the same question again and again. And the people who reply to your post know that the issue has been resolved and they can stop working on it.