• Prajapati.Lakhan
  • NEWBIE
  • 108 Points
  • Member since 2011

  • Chatter
    Feed
  • 4
    Best Answers
  • 1
    Likes Received
  • 1
    Likes Given
  • 23
    Questions
  • 47
    Replies

Hello,

I have created a trigger that allows me to assign the proper owner to my opportunities.

I am willing to do the same on a *custom* object, but I cannot use the OwnerId: the (standard) API does not provide this field.

This is very rare for two reasons:

 

  1. The "OwnerId" field can be assigned by external tools such as "Apex Loader" and "Apatar connector".
  2. I can see all the other standard fields in my custom object, using the following code:
Map<String, Schema.SObjectField> m = Schema.SObjectType.MyCustomObject__c.fields.getMap();

 

 

 

Am I missing something here? Is there any workaround?


Thanks and regards

Below is Salesforce's documentation on the order of execution on save of a record : validations, triggers and so on.

 

Order of Execution


The note under pt.11 says, "The before and after triggers fire one more time only if something needs to be updated. If the fields have already been set to a value, the triggers are not fired again".

I find the second statement "If the fields have already been set to a value, the triggers are not fired again" confusing. How does the system know that a field has already been set to a value? If they mean "no field updates on that object", doesn't it make the sentence redundant?

Am I missing something here?

  • February 03, 2012
  • Like
  • 0

Here is a reduced snippet of what I have so far:

 

<apex:page standardController="Case" extensions="NrtListController">
	<apex:param name="caseID" value="{!Case.id}"/>
	Standard CaseID: {!Case.id}
	Extension CaseID: {!CaseNrt}
</apex:page>

public class NrtListController {
	public NrtListController(ApexPages.StandardController controller) {}
	public String getCaseNrt(){
        	return System.currentPagereference().getParameters().get('caseID');
	}
}

 

 

This page returns

Standard CaseID: 500T0000002mTLlIAM

Extension CaseID:

 

How can I get the current objects ID to the extension controller (The extension CaseID should be the same as the Standard CaseID)?

 

Thanks,

Matt

 

  • April 16, 2011
  • Like
  • 0

I am using a dynamic query with two date variables.  The date variable is not in the correct format.  I did a system debug and the format is:

 

2011-02-26 00:00:00

 

How can I convert the date into the correct format to use in my dynamic query?

 

Here is my query:

 

strSOQL = 'select id,ownerId,subject,description,activitydate,activitydatetime,DurationInMinutes from Event where activitydate >= ' + da[0] + ' AND activityDate <= ' + da[1] + ' order by activitydatetime';

 

Thanks for any help.

Hi,
Usually while creating portal users, 3 portal roles are created based on the portal account.
From online documents I came to know that there is limit of max. 5000 portal roles.
Please let me know if someone is aware of whether this limit can be increased by contacting SFDC?
If yes then what is the extended/upper-cap limit?

Thank You,

 

Does someone has any idea, how to use "Territory and Subordinates" group while configuring account assignment rule?

 

 

Thank You,

Hi,

 

 

Is there any relationship between partner accounts (sobjects - Partner, AccountPartner, OpportunityPartner) and partner portal user? 

 

My understanding is account partner, opportunity partner records are just information (info of partner relationship between mutual account records) it does not have anything to do with partner portal or partner users.

 

Please confirm/correct my understanding, I have to clean partner records from database and recreate them for same mutual account because of change in reverse partner role.


Thank You !

Lakhan

Hi,

 

I know that we can iterate at most 50M rows using query locator, does anybody have any idea about SOQL rows limit for sub query used in query locator? 

 

Thanks in advance.

 

Thanks,

Lakhan

Hi all,

 

As we can define app ,tab, object etc. permissions at user level using "permissionSet". 

I know that we can query object and field permissions using SOQL in apex.

In similar way is there any way to retrieve app and tab permissions? 

Is there any other way using REST/SOAP/Metatadata API ?

 

 

Thanks,

Lakhan

Hi,

 

After installing a managed package from AppExchange, we can assign the package licenses using manage licenses link. Is there any way either using APEX or any API (enterprise/partner/metadata) to retrieve the information about managed package license assignment for an org.

 

 

 

Best Regards,

Lakhan Prajapati

Hi,

 

Which translation API/toolkit is used by Salesforce  to translate standard UI text/labels, I want to customize some labels/text  in setup configuration page.

 

Is there any way by which I can configure/modify translation for that text/labels?

 

Regards,

Lakhan

Hi,

 

Can we make an inline visualforce page (added in account page layout) visible/compatible for salesforce mobile?


Thanks,

Lakhan

Hi,

 

Is Just in Time User Provisioning supported for Idp initiated login? If so, are there any other configuration I need to do or it is just a checkbox for Enable User Provisioning.

 

Do I need to create custom SAML request with the additional params for user provisioning?

 

Thanks,

Lakhan

Hi everybody, I am facing an issue in SiteLogin form.

I have to use onComplete or rerender functionality on complete of login form submit. When i start using rerender parameter login function is not getting called. if I remove forceSSL="true" from login form "Login"action is getting called but with failure.

 

I though an alternative of not to use ajax behaviour and redirect to an intermediate page (with same controller so that i could reuse the binded variables in hidden inputs) and then perform the desired action but cunstrocture is getting called agian in new page (view state is not preserved).

 

If somebody faced the same issue please share your inputs, thanks

 

 

Thanks,

Lakhan

Hi Everybody,

 

Is there any standard endpoint in Force.com REST API by which we can submit a particular record for approval process? 

 

 

Thanks,

Lakhan

 

Hi,

 


I have a requirement where a junction object can be used to associate set of objects to a particular object.

 

e.g. I want to create mapping between  A, B, C, D and X object. Either of A, B, C, D can be associated with object X. Instead of creating lookups for each object (A, B, C, D) I want to create only one text field which will store the SFDC ID (of A, B, C or D).

 

I want to know how feasible this data model is? What kind of problems i would face with this data model?

 

 

Thanks,

Lakhan

Hi ,

 

Can we achieve the forgot password and reset password functionality using Force.com REST API?

 


Thanks,
Lakhan

Hi,

 

Is there any workaround to provide new functionality on lookup dialog for custom object, in the similar way SFDC provided it for Accounts (and other standard objects by enabling quick create)?

I found long discussion about this feature in following idea, but i dont want to create custom visualforce page for this.

 

https://sites.secure.force.com/success/ideaView?c=09a30000000D9xtAAC&id=08730000000BrAMAA0&mc=0:

 

 

Thanks,

Lakhan

Hi,

 

 

Does somebody know which type of APIs (SOAP/REST) DataLoader uses to export content (ContentVersion) data from SFDC?

 

Thanks,

Lakhan

 

 

 

Hi Everyone.

 

Do you have idea about how to associate a salesforce content doc with a custom object record using Apex? I have done ths using standared functionlity with follwing steps -

 

1. Add "Related Content" related list to the pagelayout of selected custom object

2. Click on the  "Search All" button. It will redirec to the Conent tab (With list of all shared content docs/images/videos)

3. Select particular content doc and click on the "Attach" link besides the selected content.

 

Content will be associated with the selected record and will be displayed in "Related Content" related list.

But i dont understand how this association is handled in backend (database point of view). I did not find any relational fields in ContentDocument or ContentVersion object using them we can establish this relationship.

 

How to create this mapping between object record and sfdc conten?

What is  the use of parameters "eid" and "rel" passed after clicking on Find Content button of "Related Content" related list?

 

Any help will be apriciated!!

 

Thanks in advance

Lakhan

Hi,

 

Do you have any idea how status picklist values in Lead object are related with LeadStatus object? if we add new value to the picklist will it create new record in LeadStatus object or "LeadStatus" object is only exposed for API calls?

 

Similar doubt for opportunity stage.

 

Ref link of standard objects schema daigram.

 

 

 

 

Thanks,

Lakhan

Hi,,

Salesforce didnot provide good documentation for WSDL2Apex. In my case security header information cannot be included in WSDL so i have to modify generated apex classes . e.g.- If we want to deliver following soap element- 

<foo a="b"><bar>baz</bar></foo>

  then you will have to create followin mapping class -

public class foo {
      public MyService.bar bar;
      public String a;
      private String[] bar_type_info = new String[] {'bar','http://schema.myservice.com','bar','0','1','true'};
      private String[] a_att_info = new String[] {'a'};
      private String apex_schema_type_info = new String[] {'http://schema.myservice.com','false','false'};
      private String[] field_order_type_info = new String[] {'bar'};
   }

 

Have somebody figured out how to create mapping class for the following xml ?

<foo bar="baz">bar</foo>

 Thanks,

Lakhan

Hi Everyone,

 

I am trying to consume some apis in salesforce thier authentication approach is as follows -

 

When we send an HTTP login request to the given endpoint with the usename and password header following items are expected to return -
1. A session cookie, jsessionid. The client must use this cookie when submitting subsequent requests, including logoff requests.
2. A status code of 200, if the session does not encounter any errors. This indicates that the request succeeded.

 

The problem is that when I tried this api call using Apex callout, it returned status code of 200 but no cookie with the name 'jsessionid' is created. However i tried this API call using XMLHttpRequest object it works fine.

 

Please let me know if somebody knows the issue.

 

 

Thanks,

Lakhan

Hi,

 

In my custom salesforce application I have a use case to create a new contact and optionaly I want to store image/photo for that contact. Can i use attachment to store photos for each contact?. Will there be any data storage issues?

 


Thanks,

Lakhan

 

 

Hi,

 

I know that we can iterate at most 50M rows using query locator, does anybody have any idea about SOQL rows limit for sub query used in query locator? 

 

Thanks in advance.

 

Thanks,

Lakhan

Hi,

 

I know that we can iterate at most 50M rows using query locator, does anybody have any idea about SOQL rows limit for sub query used in query locator? 

 

Thanks in advance.

 

Thanks,

Lakhan

Hi all,

 

As we can define app ,tab, object etc. permissions at user level using "permissionSet". 

I know that we can query object and field permissions using SOQL in apex.

In similar way is there any way to retrieve app and tab permissions? 

Is there any other way using REST/SOAP/Metatadata API ?

 

 

Thanks,

Lakhan

Hello,

I have created a trigger that allows me to assign the proper owner to my opportunities.

I am willing to do the same on a *custom* object, but I cannot use the OwnerId: the (standard) API does not provide this field.

This is very rare for two reasons:

 

  1. The "OwnerId" field can be assigned by external tools such as "Apex Loader" and "Apatar connector".
  2. I can see all the other standard fields in my custom object, using the following code:
Map<String, Schema.SObjectField> m = Schema.SObjectType.MyCustomObject__c.fields.getMap();

 

 

 

Am I missing something here? Is there any workaround?


Thanks and regards

Hi there, our code is describing a list of sobjects. The describe call is returning with the error: "INVALID_TYPE: sObject type 'MUSW__Permit__c' is not supported."

 

We know this is due to the profile not given any permissions on a particular object in the list. How do we check in the code to see if the user's profile has access to the objects first and then call describe on the list?

 

The situation is in an scontrol, but we need to learn how to do this in apex also. Our main concern is that describe calls are expensive in time, so we want to minimize the amount of describe calls to make.

 

Ideas?

 

  • March 03, 2012
  • Like
  • 0

Below is Salesforce's documentation on the order of execution on save of a record : validations, triggers and so on.

 

Order of Execution


The note under pt.11 says, "The before and after triggers fire one more time only if something needs to be updated. If the fields have already been set to a value, the triggers are not fired again".

I find the second statement "If the fields have already been set to a value, the triggers are not fired again" confusing. How does the system know that a field has already been set to a value? If they mean "no field updates on that object", doesn't it make the sentence redundant?

Am I missing something here?

  • February 03, 2012
  • Like
  • 0

Hi,

 

Can we make an inline visualforce page (added in account page layout) visible/compatible for salesforce mobile?


Thanks,

Lakhan

Hi Everybody,

 

Is there any standard endpoint in Force.com REST API by which we can submit a particular record for approval process? 

 

 

Thanks,

Lakhan

 

Hi All,

 

There are lots of execution governors and limits in salesforce. But I'm confusing from these governors are applying per organization or per user. OR are there any categorization for per organization limits and per user limits?

 

Thanks in Advance

Anybody is able to control the behavior of apex listviews component within the apex tabpanel

this is the code if i take some number of tabs within the tabpanel and using the listviews component within the tab component  and try to click any of the filters like A,B,C,..... etc or next or previous link , my page get refreshes and it lands to default tab of tabpanel showing unexpected behavior of tab within one apex page. this is the code. Any comment will be appreciated.

<apex:page showHeader="false">
   <apex:tabPanel switchType="client" id="tabpanel">
   <apex:tab label="TAB 1" id="object1">
   <apex:ListViews type="Case"/>
   </apex:tab>    
 
    <apex:tab label="TAB 2" id="object2">
            <apex:listViews type="account"/>
    </apex:tab> 
    </apex:tabPanel>
</apex:page>

 

Thank you

Hi,

 

I want to use the HTML Editor that salesforce provides when we click on "send an email" button on account/contact/ Lead's  ActivityHistory related list and seecting the email format to "HTML", in my visualforce page...Can i use that in my vf page? if yes, what will be the data type for the variable that i will bind with this editor area?

 

Also I want to use a inputTextArea in my page with its "richText" attribute set to true..Below is the way i am using it

 

<apex:inputTextArea richText="true" value="{!InpValue}"/>

 

when i debug the value of Inpvalue in my class it comes as blank...any ideas how to use this? The datatype for InpValue is String..

 

any help would be appreciated.

 

Thanks,

saas4u

 

 

Hello everyone, do you think It's possible to create an object with 3 fields (numbers) and load between 4.000.000 - 5.000.000 records?

 

Will I have storage issues? May I demand more data storage to SF?

 

Thanks in advance!!

Is there any limit to the number of entries in a set or list that can be used in an IN clause in SOQL?

 

 

List<Id>myIdList = ....

List<OpportunityLineItem>oliList = [select id, opportunityId, quantity
                                    from OpportunityLineItem
                                    where id in :myIdList];

 

Is there anythg that would prevent myIdList having 100, or 1000, or 5000 entries and still working with the SOQL query?

 

I'm evaluating two ways of embedding vf pages inside each other, essentially two ways of doing the same thing:

 

The first with an iframe
<iframe src="{!pageUrlString}" width="800" height="700" ></iframe>


The second with a page include         
<apex:include id="pageArea" pageName="{!pageUrlString}" rendered="true"/>

The iframe renders the second page just fine.

The apex include gives an internal server error.

 

 

An internal server error has occurred
An error has occurred while processing your request. The salesforce.com support team has been notified of the problem. If you believe you have additional information that may be of help in reproducing or correcting the error, please contact Salesforce Support. Please indicate the URL of the page you were requesting, any error id shown on this page as well as any other related information. We apologize for the inconvenience. 

Thank you again for your patience and assistance. And thanks for using salesforce.com! 

Error ID: 949465384-11147 (680958693)

 

My question is am I using the apex include component wrongly or do I need to open a ticket?

 

hi

 

Why can't we use SoSL in Triggers.

 Thanks In advance

  • January 11, 2011
  • Like
  • 0

Apex Governor limit document states "In a SOQL query with parent-child relationship sub-queries, each parent-child relationship counts as an additional query. These types of queries have a limit of three times the number for top-level queries."

 

1) Referring to "In a SOQL query with parent-child relationship sub-queries, each parent-child relationship counts as an additional query." If i execute following query, the no of SOQL executed needs to be Three. Yet debug log shows me 1 Query (and not 3). Am I missing anything?

List<Account> a =[Select Id, (Select Id from Contacts),(Select Id from Cases) from Account];


2) Can someone elaborate more on what does "These types of queries have a limit of three times the number for top-level queries." means?

The 10K character limit on SOQL statements is causing major headaches as we add custom fields to an objectAs soon as you have around 325 fields with 30 character field name you start to hit this issue because the Select SOQL statement blows the limit.

 

Even when you write code to split the select list and get two query resultsyou can't 'ORDER BY ID' in SOQL to make the join of the two query results easier. When you are dealing with millions of rows, the 10K limitation forces you into writing a complicated merge/join logic for million row data streams. Also, there is no guarantee that the two query results will have the same number of rows because there is no ability to 'lock' the table so the query results are the same (i.e a row could be deleted between the time of the two queries. Now, you are writing merge join logic where there could be a row in one stream but not in the other.

 

Is it possible to add 'Select *' to the SOQL language so that we can avoid this ?

 

How have others dealt with this limitation ?

 

Bill

 

I have code in production that passes all unit tests and works fine in most cases but in some instances I am getting an Invalid Query Locator error and I can't figure out why.

 

 

My code is a custom rollup trigger that  triggers when a case is 'Closed'.  Rolling up data from cases to their parent accounts.

 

 

My code loops through trigger.new to collect the accountid associated with each case that has just closed.  It then loops through the list of accounts pulling and account record and any associated cases.  Finally it loops through the accounts, loops through each account's cases, and adds up all of the appropriate values depositing the result into fields within the Account then updates the account.  A simple rollup really.

 

 

This works fine most of the time but I have come across some accounts that fail this process, it doesn't matter which case is closed on the account, I always get the same error so the problem is with the account not with the case.  This account has roughly 340 closed cases, though I don't believe that is anywhere near any kind of limit.

 

 

To get to my point, I'm not sure what 'Invalid Query Locator' means in this particular case.  I have seen very little info about the Query Locator, all of it old, but it all suggests problems that occur when querys time out or have been 'garbage collected'.  In this case the error comes back immediately so timeout or memory cleanup should not be an issue.

 

 

 

Below is the relevant code, it's chopped to remove specific custom field names and such so it's pretty ugly.

 

Any help is greatly appreciated.

 

Many Thanks

Jon

 

 

 

 

//if the given trigger has just been closed then roll up the FQTD follup values

set<ID> FQTDAccountIDs = new set<ID>(); //list of Accounts involved with fqtd rollup calculations
map<ID, Account> AccountsToUpdate = new map<ID, Account>(); //the accounts that will be updated by this trigger


//prepare for FQTD rollup

Integer i = 0;
for(case theCase : trigger.new)//loop through all of the available records in the trigger
{
if((trigger.old[i].status != 'Closed') && (trigger.new[i].status == 'Closed'))
{
if(!FQTDAccountIDs.contains(trigger.new[i].accountid))
{
FQTDAccountIDs.add(trigger.new[i].accountid);
System.Debug('Adding Account to the FQTD List: ' + trigger.new[i].accountid);
}
}
i++;
}


//ok, so we may have a list of records to update, lets get to the action
if(FQTDAccountIDs.size() > 0) //do we have any records to update?
{

 

  //loop through all accounts and add them, with their cases, to a map for later looping

for(Account thisAccount : [Select Id, name, (Select casenumber, status From Cases where status = 'Closed') From Account where id in :FQTDAccountIDs])
{
AccountsToUpdate.put(thisAccount.id, thisAccount);
}


//loop through each specified account
for(Account currentAccount : AccountsToUpdate.values())
{




// ****** This next for loop is the apparent problem; System.Exception: invalid query locator ********

//loop through all cases associated with this account
for(Case theCase : currentAccount.Cases)
{

//calculate the fields and rollup the data
// currentAccount.rolledupfield += theCase.rollupfield1__c + theCase.rollupfield2__c
}



}


//update the Accounts with the new values
update AccountsToUpdate.values();



}

 

 

Is there any limit to the number of entries in a set or list that can be used in an IN clause in SOQL?

 

 

List<Id>myIdList = ....

List<OpportunityLineItem>oliList = [select id, opportunityId, quantity
                                    from OpportunityLineItem
                                    where id in :myIdList];

 

Is there anythg that would prevent myIdList having 100, or 1000, or 5000 entries and still working with the SOQL query?