• MXG
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 6
    Replies
Hi community,
I have a short question about the topic API Call Limit.
In the past I read that a single user has a hourly API call limit of 3600 calls (in a other forum, but I don't find this post anymore).
Is this true? I don't find any informations about that and I have to know the answer.

Thank you! Mxg
 
  • April 20, 2018
  • Like
  • 0
Hi community,
I want to create a trigger. This trigger should generate a 6 digit code and should check, if this code is unique.

Here is my code:
 
trigger LeadIdentCodeTrigger on Lead (before insert, before update) {  
    for(Lead leadObject: Trigger.new) {    
        Boolean isUniqueIdent = true;
        
        // If lead cloned, check if ident is unique
        List<Lead> leadListWithSameIdent = [SELECT Id FROM Lead WHERE Ident__c=:leadObject.Ident__c AND Id!=:leadObject.Id LIMIT 1];
        if(leadListWithSameIdent.size() > 0) {
            isUniqueIdent = false;
        }
        
        if(leadObject.Ident__c == null || isUniqueIdent == false) {
            Boolean identExists = true;
            
            while(identExists == true) {
                // 1) Create new number
                
                identExists = false;
                
                // ---------------- Stringbuilder ------------------
                final String chars = '0123456789abcdefghijklmnopqrstuvwxyz';
                String ident = '';
                while (ident.length() < 6) {
                    Integer idx = Math.mod(Math.abs(Crypto.getRandomInteger()), chars.length());
                    ident += chars.substring(idx, idx+1);
                }
                // ------------------------------------------------
                
                // 2) Does the leadId exist?
                List<Lead> leadsWithSameIdent = [SELECT Id FROM Lead WHERE Ident__c=:ident AND Id!=:leadObject.Id LIMIT 1];
                if(leadsWithSameIdent.size() > 0) {
                    identExists = true;
                }
                
                // 3) Yes => return Step 1, No => update lead
                if(identExists == false) {
                    leadObject.Ident__c = ident;
                }
            }
        }
    }
}



The code works on our test system, but when I deploy it on production I get the following error:
 
LeadIdentCodeTrigger: execution of BeforeUpdate 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) ()



I don't understand the problem.. The query should return max. 1 result.. I have to search for duplicates in leads.

I tried to work with a list out of the for-loop, but then I have to load to much data (every of our 500.000 leads will have an unique 6 digit code in the future).

I hope someone has an idea. Thanks.
  • February 16, 2018
  • Like
  • 0
Hi community,
when I try to get the ContentDocument informations via REST API and with my admin user than I get all informations out of the table. But when I try to get the informations with my API User (the user is part of a separate API profile) than I get "No records matched query".

I don't know whats wrong, maybe it is a visibiliy problem, but the api profile is a copy of the sys admin profile and has all rights to view all data ("View All Data" checked in Administrative Permissions and "Modify All" is checked for every Standard Object Permissions/Custom Object Permissions).

This is the query I run:
 
Select Id,IsArchived,ArchivedById,ArchivedDate,IsDeleted,OwnerId,Title,PublishStatus,LatestPublishedVersionId,ParentId,LastViewedDate,LastReferencedDate,Description,ContentSize,FileType,FileExtension,SharingOption,ContentModifiedDate,ContentAssetId from ContentDocument
I hope someone can help me, thanks!

 
  • December 13, 2017
  • Like
  • 0
Hi Community,
I want to get all informations out of the ContentDocument table via REST API (SOQL). 

The call works - I get a response, but only for my admin user (with all informations about the documents).. when I test the api call with our "company API user" the API returns a 200 response - but this response does not contain any information (the api user is not a part of the sys admin profile. The user is in a custom profile.)

Now I think that our api user does not have enough visibility rights. Can I set object visibility of system objects to a non admin profile?

Thanks!
  • November 29, 2017
  • Like
  • 0
Hi Community,
I read in the past that a user has a request limit of 3600 requests per hour.
Is there a way to increase this limit for a single user? For example my company has 30 user licences, can I configure that user A can do 10.000 requests per hour and the other users can only do a few requests?

Thanks.
  • November 07, 2017
  • Like
  • 0
Hi Community,
I want to transfer notes to salesforce as Chatter Feeds.

I found this post https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_resources_feed_element.htm to create feed-elements via rest api, but I have to set the createdDate property of a record.

In the "setup" I set the 'Enable "Set Audit Fields upon Record Creation" and "Update Records with Inactive Owners" User Permissions' option and my API User Profile got the right to 'Set Audit Fields upon Record Creation'.

Can I set the createdDate via POST Request?
I hope someone can help me.
  • October 26, 2017
  • Like
  • 0
Hi Community,
I want to set the IsConverted (=true) variable of a Lead, but it is a readonly field...

We are creating leads, opportunities, contacts and accounts via api and we want to set the lead as converted. Is there a way to do this via api? I found the LeadConvert class, but this class will merge informations and I can not disable the option to create a new opportunity.
I hope someone could help me. Thanks.
  • October 18, 2017
  • Like
  • 0
Hi Community,
I have created a new 'OpportunityOffer' object and I can only create a new OpportunityOffer object as a child object of an Opportunity.

So I want to override the New button of the OppertunityObject, because I have to set the recordtype automatically. If I have an Opportunity with type (custom field) X, than I have to set the recordtype X for the new OpportunityOffer.

I created the following:

<apex:page standardController="OpportunityOffer__c" extensions="ManualOfferRecordTypeSelectionExtension"
           action="{!URLFOR($Action.OpportunityOffer__c.New, null, [retURL=URLFOR($Action.Opportunity.Tab, $ObjectType.Opportunity), RecordType='{!recordType}'], true)}">

My Controller finds the right recordtype - but I think that the action does not wait for the result of my controller - the wrong recordtype is set. I tested to set a recordtype Id into the action, that worked - but not with a controller value.

Is there a way to create the action in the controller? I found nothing in the internet that help me.. 
  • October 12, 2017
  • Like
  • 0
Hello community,
I'm new in salesforce development. I want to change the lead status & owner by clicking on a button.

I created a visualforce page and a class:
 
<apex:page standardController="Lead" extensions="LeadUpdater" action="{!UpdateLeadOwnerAndStatus}">
    <apex:form >
        <apex:inputHidden value="{!lead.OwnerId}" />
    </apex:form>
</apex:page>
public class LeadUpdater  {
	private Id ownerId;
	private Id leadId;
	private Lead lead;

	// constructor
	public LeadUpdater(ApexPages.StandardController controller) {
		this.lead = (Lead)controller.getRecord();
		this.leadId = lead.Id;
		System.debug('The lead to update is: ' + this.lead);
		this.ownerId = UserInfo.getUserId();
	}

	// update lead owner and status
	public PageReference UpdateLeadOwnerAndStatus() {
		// Logic
		this.lead.OwnerId = this.ownerId;
		this.lead.Status = 'XYZ';
		update this.lead;

		PageReference pageRef = new ApexPages.StandardController(this.lead).view();
		pageRef.setRedirect(true);

		return pageRef;
	}
}

Then I added the visualforce page to the "Salesforce1 and Lightning Experience Actions".

Now I can change status & owner by one click, BUT when the user redirect to the lead detail page - he see the old status&owner. The user has to reload the page 1-2 times to see the new data. Is there a way to reload the page with the new data via apex?


 
  • October 02, 2017
  • Like
  • 0
Hi community,
I want to create a trigger. This trigger should generate a 6 digit code and should check, if this code is unique.

Here is my code:
 
trigger LeadIdentCodeTrigger on Lead (before insert, before update) {  
    for(Lead leadObject: Trigger.new) {    
        Boolean isUniqueIdent = true;
        
        // If lead cloned, check if ident is unique
        List<Lead> leadListWithSameIdent = [SELECT Id FROM Lead WHERE Ident__c=:leadObject.Ident__c AND Id!=:leadObject.Id LIMIT 1];
        if(leadListWithSameIdent.size() > 0) {
            isUniqueIdent = false;
        }
        
        if(leadObject.Ident__c == null || isUniqueIdent == false) {
            Boolean identExists = true;
            
            while(identExists == true) {
                // 1) Create new number
                
                identExists = false;
                
                // ---------------- Stringbuilder ------------------
                final String chars = '0123456789abcdefghijklmnopqrstuvwxyz';
                String ident = '';
                while (ident.length() < 6) {
                    Integer idx = Math.mod(Math.abs(Crypto.getRandomInteger()), chars.length());
                    ident += chars.substring(idx, idx+1);
                }
                // ------------------------------------------------
                
                // 2) Does the leadId exist?
                List<Lead> leadsWithSameIdent = [SELECT Id FROM Lead WHERE Ident__c=:ident AND Id!=:leadObject.Id LIMIT 1];
                if(leadsWithSameIdent.size() > 0) {
                    identExists = true;
                }
                
                // 3) Yes => return Step 1, No => update lead
                if(identExists == false) {
                    leadObject.Ident__c = ident;
                }
            }
        }
    }
}



The code works on our test system, but when I deploy it on production I get the following error:
 
LeadIdentCodeTrigger: execution of BeforeUpdate 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) ()



I don't understand the problem.. The query should return max. 1 result.. I have to search for duplicates in leads.

I tried to work with a list out of the for-loop, but then I have to load to much data (every of our 500.000 leads will have an unique 6 digit code in the future).

I hope someone has an idea. Thanks.
  • February 16, 2018
  • Like
  • 0
Hi Community,
I want to get all informations out of the ContentDocument table via REST API (SOQL). 

The call works - I get a response, but only for my admin user (with all informations about the documents).. when I test the api call with our "company API user" the API returns a 200 response - but this response does not contain any information (the api user is not a part of the sys admin profile. The user is in a custom profile.)

Now I think that our api user does not have enough visibility rights. Can I set object visibility of system objects to a non admin profile?

Thanks!
  • November 29, 2017
  • Like
  • 0
Hi Community,
I want to transfer notes to salesforce as Chatter Feeds.

I found this post https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_resources_feed_element.htm to create feed-elements via rest api, but I have to set the createdDate property of a record.

In the "setup" I set the 'Enable "Set Audit Fields upon Record Creation" and "Update Records with Inactive Owners" User Permissions' option and my API User Profile got the right to 'Set Audit Fields upon Record Creation'.

Can I set the createdDate via POST Request?
I hope someone can help me.
  • October 26, 2017
  • Like
  • 0
Hi Community,
I want to set the IsConverted (=true) variable of a Lead, but it is a readonly field...

We are creating leads, opportunities, contacts and accounts via api and we want to set the lead as converted. Is there a way to do this via api? I found the LeadConvert class, but this class will merge informations and I can not disable the option to create a new opportunity.
I hope someone could help me. Thanks.
  • October 18, 2017
  • Like
  • 0
Hi Community,
I have created a new 'OpportunityOffer' object and I can only create a new OpportunityOffer object as a child object of an Opportunity.

So I want to override the New button of the OppertunityObject, because I have to set the recordtype automatically. If I have an Opportunity with type (custom field) X, than I have to set the recordtype X for the new OpportunityOffer.

I created the following:

<apex:page standardController="OpportunityOffer__c" extensions="ManualOfferRecordTypeSelectionExtension"
           action="{!URLFOR($Action.OpportunityOffer__c.New, null, [retURL=URLFOR($Action.Opportunity.Tab, $ObjectType.Opportunity), RecordType='{!recordType}'], true)}">

My Controller finds the right recordtype - but I think that the action does not wait for the result of my controller - the wrong recordtype is set. I tested to set a recordtype Id into the action, that worked - but not with a controller value.

Is there a way to create the action in the controller? I found nothing in the internet that help me.. 
  • October 12, 2017
  • Like
  • 0