• Mauricio Oliveira
  • NEWBIE
  • 65 Points
  • Member since 2013

  • Chatter
    Feed
  • 1
    Best Answers
  • 5
    Likes Received
  • 0
    Likes Given
  • 13
    Questions
  • 24
    Replies
Hi there,

I have a trigger to keep Opportunity and Quote Line Items custom field synced. In this process I compare some of the fields of QuoteLineItem and OpportunityLineItem (to find out which ones are corresponding). So I query the items and check for some fields, including UnitPrice. When the user's profile currency is different from the related records currency, the UnitPrice is being converted in one of the objects (QuoteLineItem), but not in the other (OpportunityLineItem), so my mapping fails and my trigger does nothing because it couldn't find a matching item to sync fields. These are the queries my trigger does:
 
String qliQuery = 'select Id, QuoteId, PricebookEntryId, UnitPrice, Quantity, SortOrder, CurrencyIsoCode' + qliFields + ' from QuoteLineItem where Id in (' + qliIds + ') order by QuoteId, SortOrder ASC';
List<QuoteLineItem> qlis = Database.query(qliQuery);

String oliQuery = 'select Id, OpportunityId, PricebookEntryId, UnitPrice, Quantity, SortOrder, CurrencyIsoCode' + oliFields + ' from OpportunityLineItem where OpportunityId in (' + oppIds + ') order by OpportunityId, SortOrder ASC';
List<OpportunityLineItem> olis = Database.query(oliQuery);
Where qliFields and oliFields define which custom fields will be synced, qliIds contains the new QuoteLineItems being created, and oppIds are the IDs of the Opportunities related to the entries that fired this trigger.

These queries are done in an after insert context in the QuoteLineItem object. The result of the both queries is below (I ommited some of the irrelevant fields):
 
[Debug] COMPARING: QuoteLineItem:{Id=0QLc0000002mkaVGAQ, QuoteId=0Q0c0000000acKFCAY, PricebookEntryId=01u0B00000rRLZmQAO, UnitPrice=2855.60, Quantity=1.00, CurrencyIsoCode=USD, ...}

[Debug] COMPARING: OpportunityLineItem:{Id=00kc000000AREWCAA5, OpportunityId=006c000000GFc4SAAT, PricebookEntryId=01u0B00000rRLZmQAO, UnitPrice=1298.00, Quantity=1.00, CurrencyIsoCode=USD, ...}
Note that UnitPrice is returning 2855.60 in this query (which is 1298.00 * 2.20, our default currency conversion rate). Although, both records are registered with CurrencyIsoCode as USD (as they should be). All other records (Opportunity, Quote, PricebookEntry) are registered as USD.

So, when comparing by UnitPrice, those two records never match and my trigger fails its goal. I will remove this comparison and use other criteria for matching, so my problem will be solved for now, but I would like very much to understand this behavior.

​Any help? Thanks in advance.

Hi there,

I have this custom Visualforce page for QuoteLineItem's multiple edit. It works as a shopping cart: it has the Quote items at the top, and the list of available pricebook entries with a search bar. Some users have reported that this multi-line edit page is messing around some data, as QuoteLineItem "A" getting item "B" data (custom fields that were filled in this page) after saving.

I was able to reproduce one of the mess arounds that can happen. I suspect other cases are variations of this one, so I'm focusing on getting this one fixed before going further. But I don't know what is going on. See detailed explanation below:

1. This is the initial page, I already have 4 QuoteLineItems in the Quote. Check out the "New/Renewal" column. Red arrow is where I will click next.
User-added image

2. Selecting an item from the "Available Products", it goes to the shopping cart as expected, without "New/Renewal" field filled (no default value for that field, nad not added when the QuoteLineItem is created via code). All good for now, but before filling out the visible fields, I will just remove an existing item that I don't want anymore...
User-added image

3. Now it gets weird. "New/Renewal" field of the new item gets populated with the last existing item's value. View State confirms that is does not have that filled.
User-added image

4. I just ignored that and hit Save without filling the other fields. So it does not pass validation and the page is reloaded with error message. But this time the wrong "New/Renewal" value was cleared.
User-added image


So, this is what is going on. Any idea of what is going on?

Visualforce page: "Remove" button:

<apex:column>
    <apex:commandButton value="Remove" action="{!removeFromShoppingCart}" reRender="selected,searchResults" immediate="true" status="loadStatus">
        <apex:param value="{!index}" assignTo="{!toUnselect}" name="toUnselect"/>
    </apex:commandButton>
</apex:column>

Visualforce page: "Select" button
<apex:column >
    <apex:commandButton value="Select" action="{!addToShoppingCart}" reRender="selected,searchResults" immediate="true" status="loadStatus">
        <apex:param value="{!a.Id}" assignTo="{!toSelect}" name="toSelect"/>
    </apex:commandButton>
</apex:column>

Apex class: removeFromShoppingCart
public PageReference removeFromShoppingCart() {
    QuoteLineItem to_remove = shoppingCart.remove(Integer.valueOf(toUnselect));
    if (to_remove.Id != null) {
        // Can only delete if item was already inserted into database (has ID)
        forDeletion.add(to_remove);
    }
    updateAvailableList();
    return null;
}

Apex class: addToShoppingCart
public void addToShoppingCart() {
    for(PricebookEntry d : AvailableProducts){
        String entry_id = (String) d.Id;
        if (entry_id.equals(toSelect)) {
            shoppingCart.add(
                new QuoteLineItem(
                        QuoteId=theQuote.Id, 
                        PriceBookEntry=d, 
                        PriceBookEntryId=d.Id, 
                        UnitPrice=d.UnitPrice, 
                        Quantity=1, 
                        SPF__c=0
                    )
                );
            break;
        }
    }
    updateAvailableList();  
}

So, what am I doing wrong? As I said, there are other cases where users edit multiple lines and after saving their custom fields get saved to different items... but the problem I reported with this simple example makes me feel I'm missing something very basic. Can someone help me?

Thanks in advance.
 
Hi everyone!

I have a visualforce page that contains a pageBlockButtons for Save/Cancel (1), and a pageBlockTable which one of the columns is a commandLink or commandButton (2) corresponding to an action to be done on that row's data.

Just to clarify what my buttons will do, the (1) buttons will already redirect the user to the previous page, but the (2) buttons/links will alter the data in the pageBlockTable and refresh the table.

But I want to avoid my users to be clicking endlessly with impatience and firing multiple events at once, so I would like to disable clicking any of those options (1 or 2) whenever one of them is pressed and while has not finishing processing. How can I do that?

Thanks in advance.
Hi there,

I need some Quote fields to have a default value, that would be updated probably in a monthly basis (basically "dated default values"). Also, ideally they should be non-editable fields, but there will be exceptions, so I'm thinking of not letting them locked for edition but rather fire some email alert to key managers warning about the edition (I've never used approval processes, not sure how they work).

So, which would be the best approach for this use case?

My first thought: Since those default values will be dated, I was thinking of creating a custom object "DatedDefaultValue" with FieldName__c, DefaultValue__c, StartDate__c and populate Quotes with a trigger on creation, and using either ISCHANGED() formulas in Workflow Rules + Email Alert or even using update triggers to warn about changes. In this approach my concern is about SOQL limits :(. By having a custom object for this (instead of using field's default value mechanism) I wouldn't lose information about previous default values.

What do you guys think? Is there any other suggestion or more common approach for this use case?

​Thanks in advance.
Hi everyone,

I have a visualforce page with a button that is supposed to call an external webservice (REST API). But now I want to make an update in my object after the callout is finished. I read this article about the Continuation class but it seems that I need access to the HttpRequest object to make this work, which is not the case. I am calling a higher level function of a managed package that will make the callout.

So, is it possible to update the object after the callout and avoid getting "You have uncommitted work pending. Please commit or rollback before calling out"?

Thanks in advance.
Hi there,

I am trying without success to add an error message to a Standard Contact details page. Is it possible? I have read a few topics which say you can't, others are using webservices or javascript code, but it is not clear to me if it is possible or not.

My context is this: I have a custom button in a Contact details page. What I want to do is to call apex code when pressing that button, which will do some operations (not validation, will actually call external webservices) and I wanted to add either a Success or Error message in the same Contact's page, not to redirect to some other visualforce page or something like that. Sounds pretty simple but my calls do ApexPages.addMessage or contact.addError are not adding anything in the Contact page.

Any help is appreciated.

Thank you in advance.
Hi there,

I have the following situation:
- My Quote has a field that is updated on its afterUpdate trigger, based on a calculation involving its QuoteLineItems
- If I simply update one of the QuoteLineItems via UI (edit item, change value, save), it also does an update on the Quote, firing its triggers which ends up calculating the value of the field I mentioned above, works fine.
- However, If I just make an 'update item' on my test, it does not update the Quote, which ends up not calculating the mentioned field

I can't see a reason why the Quote is also being updated through the UI. So, before going deeper in debug logs, I'm just wandering if there is something very obvious that I might be missing. Any thoughts?

Thanks.
 
Hi there,

I couldn't find documentation about this button anywhere, does anyone know where to find it? I want to know exactly which operations it does, so I can reproduce its exact behavior in tests.

Best regards.
Hi everyone.

I have a Quote trigger that should update a custom field when the Quote is unsynced, but I'm having troubles in representing this correctly in a test. This is from my trigger:

// Only case that it shouldn't be marked is when editing an unsynced Quote
if (!old_map.get(quote.Id).IsSyncing && !quote.IsSyncing) {
    continue;
}

sales_order.Quote_was_modified__c = true;
update sales_order;

As you can see, the field should always be updated, unless the Quote was unsynced and remains unsynced. Doing this in Salesforce interface (pressing Stop Sync button) works fine, but this test fails and I can't figure out why:

quote = [SELECT Id, IsSyncing FROM Quote WHERE Id =: quote.Id];
system.assert(quote.IsSyncing);

// Unsync that quote
opportunity.SyncedQuoteId = null;
update opportunity;

// Check if it was unsynced
quote = [SELECT Id, IsSyncing FROM Quote WHERE Id =: quote.Id];
system.assert(!quote.IsSyncing);

sales_order = [SELECT Id, Quote_was_modified__c FROM Sales_Order__c WHERE Id =: sales_order.Id];
system.assert(sales_order.Quote_was_modified__c);


This last assert fails. I have added some system.debug calls in this code and found out that it is getting into that if statement that checks if the Quote was and remains unsynced. When accessing the oldMap version of the Quote right after the update opportunity call, IsSyncing is already set to false. So, why is that happening? Am I missing something?

Thank you

Hi there,

I have created a class that stores trigger names to be deactivated during tests (I try to make a lot of unit tests, so I'm not interested in firing all my triggers on every test, and it is better to disable some of them to avoid reaching SOQL limits). So my tests have something like this:

TriggerDisabler.Disable('MyTriggerName');

And my triggers now add something like this as their first lines:
if (TriggerDisabler.IsTriggerDisabled('MyTriggerName')) {
    return;
}

But I would like to make this more generic, using something like a "trigger.Name" or something (without queries) that could return me the trigger's name, or eventually changing that method call in the trigger to "TriggerDisabler.AmIDisabled()" which could handle this itself.

Is this possible? I took a quick look in some forums and examples but couldn't find any way to obtain the trigger's name.

Any other suggestions are also welcome!

Cheers.
Hi everyone,

I started having some errors recently on my production environment and can't figure out what is going on. This is happening in a few test classes I run and by looking at the debug logs, all the tests go through everything as expected and after they are done and call test.stopTest(), the test enters managed package and things go bad. This is actually happening when entering Zendesk package, but I'm not sure if this is related to this specific package (could be some error that was being forwarded and ends up on last package or something like that).

The first thing I got was this:
Error MessageSystem.QueryException: No such column 'BillingAddress' on entity 'Account'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.
Stack Trace(Zendesk)
I don't make such query, Zendesk was making it when entering managed packages and doing a query with all fields of Account object. I don't know why that fails too, since "BillingAddress" does exist on Account object. Anyway, I was able to reproduce this first error on my Sandbox and commented the single test that makes this happen.

However, there was another error happening in other test classes, a NullPointerException also after the test.stopTest() is called on my test classes, then it enters managed package. This one I couldn't reproduce in sandbox, it just happens on production. These are the last lines of the debug logs for running one of the failing test classes.

08:42:07.956 (1956485495)|CODE_UNIT_FINISHED|testClass.geraDolares
08:42:07.956 (1956492660)|EXECUTION_FINISHED
08:42:07.957 (1957175690)|ENTERING_MANAGED_PKG|Zendesk
08:42:07.975 (1975110468)|SOQL_EXECUTE_BEGIN|[238]|Aggregations:0|SELECT RM_Account_Name__c,Account_Which_software__c,Phone,Jigsaw,Zendesk__Tags__c,ANSYS_Customer_Name__c,Knowledge_about_ESSS_products_ACCOUNT__c,Zendesk__Notes__c,ParentId,At_which_frequency_ACCOUNT__c,Type,CreatedById,LastActivityDate,Level_of_knowledge_ACCOUNT__c,Already_ANSYS_Customer__c,sfcloud__Segment__c,BillingCity,Description,IsDeleted,Account_city__c,Industry,SystemModstamp,Zendesk__Domain_Mapping__c,Fax,Zendesk__Zendesk_oldTags__c,TickerSymbol,Already_have_some_CAE_system_ACCOUNT__c,Account_zip_postal_code__c,ShippingCity,AnnualRevenue,ShippingState,BillingPostalCode,CreatedDate,JigsawCompanyId,OwnerId,Do_you_buy_CAE_services_ACCOUNT__c,ANSYS_ASC__c,Zendesk__Last_Sync_Date__c,Already_bought_services_ESSS_ACCOUNT__c,Ownership,ANSYS_Industry_group__c,Already_have_some_CAD_System_ACCOUNT__c,NumberOfEmployees,ShippingPostalCode,CNPJ__c,Zendesk__Last_Sync_Status__c,LastModifiedById,SicDesc,CurrencyIsoCode,Account_street__c,AccountSource,ANSYS_Customer_number__c,Does_your_company_have_R_D_ACCOUNT__c,Account_Sector__c,BillingState,BillingCountry,LastModifiedDate,Id,Account_Industry__c,On_Which_Technology__c,Account_state_province__c,Name,ShippingStreet,Major_Account__c,AccountNumber,Services_provider_ACCOUNT__c,Account_country__c,Zendesk__Zendesk_OutofSync__c,Site,Zendesk__Result__c,Sic,Account_Duplicate_Test__c,Website,MasterRecordId,ShippingCountry,Zendesk__Zendesk_Organization__c,BillingStreet,Zendesk__createdUpdatedFlag__c,RM_Account_Code__c,Region__c,ANSYS_Industry_subgroup__c,Zendesk__Zendesk_Organization_Id__c,Rating,ANSYS_SIC__c FROM Account Where id =: accId
08:42:07.982 (1982778015)|SOQL_EXECUTE_END|[238]|Rows:1
08:42:07.983 (1983511273)|SOQL_EXECUTE_BEGIN|[119]|Aggregations:0|select ownerid, Zendesk__Result__c, Zendesk__Zendesk_OutofSync__c, Zendesk__Zendesk_oldTags__c, Zendesk__createdUpdatedFlag__c, id, name from Account where id = :tmpVar1
08:42:07.989 (1989252932)|SOQL_EXECUTE_END|[119]|Rows:1
08:42:08.083 (2083512860)|FATAL_ERROR|System.NullPointerException: Attempt to de-reference a null object

(Zendesk)

08:42:08.083 (2083533104)|FATAL_ERROR|System.NullPointerException: Attempt to de-reference a null object

(Zendesk)

I already opened a ticket on Zendesk support, but haven't received an answer yet, and since this is blocking me from deploying things, I decided to try developer forums, maybe someone had the same or similar issue and can give me some hint.

Any ideas?

Regards.


Hi all,

 

in my organization we have the possibility of adding the same product more than once in the same quote (which is different from changing its quantity, we have other fields that vary for each line item).

 

So, what I would like in fact is that the page for "Add Line Item", where you have the product search for adding it to a quote, to have an extra field to meet that requirement. For example, a simple number field that the user fills with the number of times he wants to add that item. Without this change, he needs to add the same item as many times as he needs it (lots of clicks for each time, instead of doing all only once).

 

Does anyone know an app, or have an visualforce page code that does this? Or at least a good starting point, I'm new to creating visualforce on Salesforce.

 

 

Regards.

Hi everyone,

 

I have installed Custom Quote Sync (Managed) and it is working fine for now, but I had some problems when trying to sync a field from OpportunityLineItem and QuoteLineItem when the field on QuoteLineItem has a default value. The value is being copied to the OpportunityLineItem correctly, but when trying to create a new quote, the default value is being set over the synced value.

 

Is this a limitation of the app, or am I doing something wrong?

 

 

Regards.

Hi there,

I have a trigger to keep Opportunity and Quote Line Items custom field synced. In this process I compare some of the fields of QuoteLineItem and OpportunityLineItem (to find out which ones are corresponding). So I query the items and check for some fields, including UnitPrice. When the user's profile currency is different from the related records currency, the UnitPrice is being converted in one of the objects (QuoteLineItem), but not in the other (OpportunityLineItem), so my mapping fails and my trigger does nothing because it couldn't find a matching item to sync fields. These are the queries my trigger does:
 
String qliQuery = 'select Id, QuoteId, PricebookEntryId, UnitPrice, Quantity, SortOrder, CurrencyIsoCode' + qliFields + ' from QuoteLineItem where Id in (' + qliIds + ') order by QuoteId, SortOrder ASC';
List<QuoteLineItem> qlis = Database.query(qliQuery);

String oliQuery = 'select Id, OpportunityId, PricebookEntryId, UnitPrice, Quantity, SortOrder, CurrencyIsoCode' + oliFields + ' from OpportunityLineItem where OpportunityId in (' + oppIds + ') order by OpportunityId, SortOrder ASC';
List<OpportunityLineItem> olis = Database.query(oliQuery);
Where qliFields and oliFields define which custom fields will be synced, qliIds contains the new QuoteLineItems being created, and oppIds are the IDs of the Opportunities related to the entries that fired this trigger.

These queries are done in an after insert context in the QuoteLineItem object. The result of the both queries is below (I ommited some of the irrelevant fields):
 
[Debug] COMPARING: QuoteLineItem:{Id=0QLc0000002mkaVGAQ, QuoteId=0Q0c0000000acKFCAY, PricebookEntryId=01u0B00000rRLZmQAO, UnitPrice=2855.60, Quantity=1.00, CurrencyIsoCode=USD, ...}

[Debug] COMPARING: OpportunityLineItem:{Id=00kc000000AREWCAA5, OpportunityId=006c000000GFc4SAAT, PricebookEntryId=01u0B00000rRLZmQAO, UnitPrice=1298.00, Quantity=1.00, CurrencyIsoCode=USD, ...}
Note that UnitPrice is returning 2855.60 in this query (which is 1298.00 * 2.20, our default currency conversion rate). Although, both records are registered with CurrencyIsoCode as USD (as they should be). All other records (Opportunity, Quote, PricebookEntry) are registered as USD.

So, when comparing by UnitPrice, those two records never match and my trigger fails its goal. I will remove this comparison and use other criteria for matching, so my problem will be solved for now, but I would like very much to understand this behavior.

​Any help? Thanks in advance.
Hi there,

I have created a class that stores trigger names to be deactivated during tests (I try to make a lot of unit tests, so I'm not interested in firing all my triggers on every test, and it is better to disable some of them to avoid reaching SOQL limits). So my tests have something like this:

TriggerDisabler.Disable('MyTriggerName');

And my triggers now add something like this as their first lines:
if (TriggerDisabler.IsTriggerDisabled('MyTriggerName')) {
    return;
}

But I would like to make this more generic, using something like a "trigger.Name" or something (without queries) that could return me the trigger's name, or eventually changing that method call in the trigger to "TriggerDisabler.AmIDisabled()" which could handle this itself.

Is this possible? I took a quick look in some forums and examples but couldn't find any way to obtain the trigger's name.

Any other suggestions are also welcome!

Cheers.
Hi everyone,

I started having some errors recently on my production environment and can't figure out what is going on. This is happening in a few test classes I run and by looking at the debug logs, all the tests go through everything as expected and after they are done and call test.stopTest(), the test enters managed package and things go bad. This is actually happening when entering Zendesk package, but I'm not sure if this is related to this specific package (could be some error that was being forwarded and ends up on last package or something like that).

The first thing I got was this:
Error MessageSystem.QueryException: No such column 'BillingAddress' on entity 'Account'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.
Stack Trace(Zendesk)
I don't make such query, Zendesk was making it when entering managed packages and doing a query with all fields of Account object. I don't know why that fails too, since "BillingAddress" does exist on Account object. Anyway, I was able to reproduce this first error on my Sandbox and commented the single test that makes this happen.

However, there was another error happening in other test classes, a NullPointerException also after the test.stopTest() is called on my test classes, then it enters managed package. This one I couldn't reproduce in sandbox, it just happens on production. These are the last lines of the debug logs for running one of the failing test classes.

08:42:07.956 (1956485495)|CODE_UNIT_FINISHED|testClass.geraDolares
08:42:07.956 (1956492660)|EXECUTION_FINISHED
08:42:07.957 (1957175690)|ENTERING_MANAGED_PKG|Zendesk
08:42:07.975 (1975110468)|SOQL_EXECUTE_BEGIN|[238]|Aggregations:0|SELECT RM_Account_Name__c,Account_Which_software__c,Phone,Jigsaw,Zendesk__Tags__c,ANSYS_Customer_Name__c,Knowledge_about_ESSS_products_ACCOUNT__c,Zendesk__Notes__c,ParentId,At_which_frequency_ACCOUNT__c,Type,CreatedById,LastActivityDate,Level_of_knowledge_ACCOUNT__c,Already_ANSYS_Customer__c,sfcloud__Segment__c,BillingCity,Description,IsDeleted,Account_city__c,Industry,SystemModstamp,Zendesk__Domain_Mapping__c,Fax,Zendesk__Zendesk_oldTags__c,TickerSymbol,Already_have_some_CAE_system_ACCOUNT__c,Account_zip_postal_code__c,ShippingCity,AnnualRevenue,ShippingState,BillingPostalCode,CreatedDate,JigsawCompanyId,OwnerId,Do_you_buy_CAE_services_ACCOUNT__c,ANSYS_ASC__c,Zendesk__Last_Sync_Date__c,Already_bought_services_ESSS_ACCOUNT__c,Ownership,ANSYS_Industry_group__c,Already_have_some_CAD_System_ACCOUNT__c,NumberOfEmployees,ShippingPostalCode,CNPJ__c,Zendesk__Last_Sync_Status__c,LastModifiedById,SicDesc,CurrencyIsoCode,Account_street__c,AccountSource,ANSYS_Customer_number__c,Does_your_company_have_R_D_ACCOUNT__c,Account_Sector__c,BillingState,BillingCountry,LastModifiedDate,Id,Account_Industry__c,On_Which_Technology__c,Account_state_province__c,Name,ShippingStreet,Major_Account__c,AccountNumber,Services_provider_ACCOUNT__c,Account_country__c,Zendesk__Zendesk_OutofSync__c,Site,Zendesk__Result__c,Sic,Account_Duplicate_Test__c,Website,MasterRecordId,ShippingCountry,Zendesk__Zendesk_Organization__c,BillingStreet,Zendesk__createdUpdatedFlag__c,RM_Account_Code__c,Region__c,ANSYS_Industry_subgroup__c,Zendesk__Zendesk_Organization_Id__c,Rating,ANSYS_SIC__c FROM Account Where id =: accId
08:42:07.982 (1982778015)|SOQL_EXECUTE_END|[238]|Rows:1
08:42:07.983 (1983511273)|SOQL_EXECUTE_BEGIN|[119]|Aggregations:0|select ownerid, Zendesk__Result__c, Zendesk__Zendesk_OutofSync__c, Zendesk__Zendesk_oldTags__c, Zendesk__createdUpdatedFlag__c, id, name from Account where id = :tmpVar1
08:42:07.989 (1989252932)|SOQL_EXECUTE_END|[119]|Rows:1
08:42:08.083 (2083512860)|FATAL_ERROR|System.NullPointerException: Attempt to de-reference a null object

(Zendesk)

08:42:08.083 (2083533104)|FATAL_ERROR|System.NullPointerException: Attempt to de-reference a null object

(Zendesk)

I already opened a ticket on Zendesk support, but haven't received an answer yet, and since this is blocking me from deploying things, I decided to try developer forums, maybe someone had the same or similar issue and can give me some hint.

Any ideas?

Regards.


Hi everyone,

 

I have installed Custom Quote Sync (Managed) and it is working fine for now, but I had some problems when trying to sync a field from OpportunityLineItem and QuoteLineItem when the field on QuoteLineItem has a default value. The value is being copied to the OpportunityLineItem correctly, but when trying to create a new quote, the default value is being set over the synced value.

 

Is this a limitation of the app, or am I doing something wrong?

 

 

Regards.

Hi everyone!

I have a visualforce page that contains a pageBlockButtons for Save/Cancel (1), and a pageBlockTable which one of the columns is a commandLink or commandButton (2) corresponding to an action to be done on that row's data.

Just to clarify what my buttons will do, the (1) buttons will already redirect the user to the previous page, but the (2) buttons/links will alter the data in the pageBlockTable and refresh the table.

But I want to avoid my users to be clicking endlessly with impatience and firing multiple events at once, so I would like to disable clicking any of those options (1 or 2) whenever one of them is pressed and while has not finishing processing. How can I do that?

Thanks in advance.
Hi there,

I need some Quote fields to have a default value, that would be updated probably in a monthly basis (basically "dated default values"). Also, ideally they should be non-editable fields, but there will be exceptions, so I'm thinking of not letting them locked for edition but rather fire some email alert to key managers warning about the edition (I've never used approval processes, not sure how they work).

So, which would be the best approach for this use case?

My first thought: Since those default values will be dated, I was thinking of creating a custom object "DatedDefaultValue" with FieldName__c, DefaultValue__c, StartDate__c and populate Quotes with a trigger on creation, and using either ISCHANGED() formulas in Workflow Rules + Email Alert or even using update triggers to warn about changes. In this approach my concern is about SOQL limits :(. By having a custom object for this (instead of using field's default value mechanism) I wouldn't lose information about previous default values.

What do you guys think? Is there any other suggestion or more common approach for this use case?

​Thanks in advance.
Hi everyone,

I have a visualforce page with a button that is supposed to call an external webservice (REST API). But now I want to make an update in my object after the callout is finished. I read this article about the Continuation class but it seems that I need access to the HttpRequest object to make this work, which is not the case. I am calling a higher level function of a managed package that will make the callout.

So, is it possible to update the object after the callout and avoid getting "You have uncommitted work pending. Please commit or rollback before calling out"?

Thanks in advance.
Hi there,

I am trying without success to add an error message to a Standard Contact details page. Is it possible? I have read a few topics which say you can't, others are using webservices or javascript code, but it is not clear to me if it is possible or not.

My context is this: I have a custom button in a Contact details page. What I want to do is to call apex code when pressing that button, which will do some operations (not validation, will actually call external webservices) and I wanted to add either a Success or Error message in the same Contact's page, not to redirect to some other visualforce page or something like that. Sounds pretty simple but my calls do ApexPages.addMessage or contact.addError are not adding anything in the Contact page.

Any help is appreciated.

Thank you in advance.
Hi there,

I have the following situation:
- My Quote has a field that is updated on its afterUpdate trigger, based on a calculation involving its QuoteLineItems
- If I simply update one of the QuoteLineItems via UI (edit item, change value, save), it also does an update on the Quote, firing its triggers which ends up calculating the value of the field I mentioned above, works fine.
- However, If I just make an 'update item' on my test, it does not update the Quote, which ends up not calculating the mentioned field

I can't see a reason why the Quote is also being updated through the UI. So, before going deeper in debug logs, I'm just wandering if there is something very obvious that I might be missing. Any thoughts?

Thanks.
 
Hi there,

I couldn't find documentation about this button anywhere, does anyone know where to find it? I want to know exactly which operations it does, so I can reproduce its exact behavior in tests.

Best regards.
Hi there,

I have created a class that stores trigger names to be deactivated during tests (I try to make a lot of unit tests, so I'm not interested in firing all my triggers on every test, and it is better to disable some of them to avoid reaching SOQL limits). So my tests have something like this:

TriggerDisabler.Disable('MyTriggerName');

And my triggers now add something like this as their first lines:
if (TriggerDisabler.IsTriggerDisabled('MyTriggerName')) {
    return;
}

But I would like to make this more generic, using something like a "trigger.Name" or something (without queries) that could return me the trigger's name, or eventually changing that method call in the trigger to "TriggerDisabler.AmIDisabled()" which could handle this itself.

Is this possible? I took a quick look in some forums and examples but couldn't find any way to obtain the trigger's name.

Any other suggestions are also welcome!

Cheers.
Hi everyone,

I started having some errors recently on my production environment and can't figure out what is going on. This is happening in a few test classes I run and by looking at the debug logs, all the tests go through everything as expected and after they are done and call test.stopTest(), the test enters managed package and things go bad. This is actually happening when entering Zendesk package, but I'm not sure if this is related to this specific package (could be some error that was being forwarded and ends up on last package or something like that).

The first thing I got was this:
Error MessageSystem.QueryException: No such column 'BillingAddress' on entity 'Account'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.
Stack Trace(Zendesk)
I don't make such query, Zendesk was making it when entering managed packages and doing a query with all fields of Account object. I don't know why that fails too, since "BillingAddress" does exist on Account object. Anyway, I was able to reproduce this first error on my Sandbox and commented the single test that makes this happen.

However, there was another error happening in other test classes, a NullPointerException also after the test.stopTest() is called on my test classes, then it enters managed package. This one I couldn't reproduce in sandbox, it just happens on production. These are the last lines of the debug logs for running one of the failing test classes.

08:42:07.956 (1956485495)|CODE_UNIT_FINISHED|testClass.geraDolares
08:42:07.956 (1956492660)|EXECUTION_FINISHED
08:42:07.957 (1957175690)|ENTERING_MANAGED_PKG|Zendesk
08:42:07.975 (1975110468)|SOQL_EXECUTE_BEGIN|[238]|Aggregations:0|SELECT RM_Account_Name__c,Account_Which_software__c,Phone,Jigsaw,Zendesk__Tags__c,ANSYS_Customer_Name__c,Knowledge_about_ESSS_products_ACCOUNT__c,Zendesk__Notes__c,ParentId,At_which_frequency_ACCOUNT__c,Type,CreatedById,LastActivityDate,Level_of_knowledge_ACCOUNT__c,Already_ANSYS_Customer__c,sfcloud__Segment__c,BillingCity,Description,IsDeleted,Account_city__c,Industry,SystemModstamp,Zendesk__Domain_Mapping__c,Fax,Zendesk__Zendesk_oldTags__c,TickerSymbol,Already_have_some_CAE_system_ACCOUNT__c,Account_zip_postal_code__c,ShippingCity,AnnualRevenue,ShippingState,BillingPostalCode,CreatedDate,JigsawCompanyId,OwnerId,Do_you_buy_CAE_services_ACCOUNT__c,ANSYS_ASC__c,Zendesk__Last_Sync_Date__c,Already_bought_services_ESSS_ACCOUNT__c,Ownership,ANSYS_Industry_group__c,Already_have_some_CAD_System_ACCOUNT__c,NumberOfEmployees,ShippingPostalCode,CNPJ__c,Zendesk__Last_Sync_Status__c,LastModifiedById,SicDesc,CurrencyIsoCode,Account_street__c,AccountSource,ANSYS_Customer_number__c,Does_your_company_have_R_D_ACCOUNT__c,Account_Sector__c,BillingState,BillingCountry,LastModifiedDate,Id,Account_Industry__c,On_Which_Technology__c,Account_state_province__c,Name,ShippingStreet,Major_Account__c,AccountNumber,Services_provider_ACCOUNT__c,Account_country__c,Zendesk__Zendesk_OutofSync__c,Site,Zendesk__Result__c,Sic,Account_Duplicate_Test__c,Website,MasterRecordId,ShippingCountry,Zendesk__Zendesk_Organization__c,BillingStreet,Zendesk__createdUpdatedFlag__c,RM_Account_Code__c,Region__c,ANSYS_Industry_subgroup__c,Zendesk__Zendesk_Organization_Id__c,Rating,ANSYS_SIC__c FROM Account Where id =: accId
08:42:07.982 (1982778015)|SOQL_EXECUTE_END|[238]|Rows:1
08:42:07.983 (1983511273)|SOQL_EXECUTE_BEGIN|[119]|Aggregations:0|select ownerid, Zendesk__Result__c, Zendesk__Zendesk_OutofSync__c, Zendesk__Zendesk_oldTags__c, Zendesk__createdUpdatedFlag__c, id, name from Account where id = :tmpVar1
08:42:07.989 (1989252932)|SOQL_EXECUTE_END|[119]|Rows:1
08:42:08.083 (2083512860)|FATAL_ERROR|System.NullPointerException: Attempt to de-reference a null object

(Zendesk)

08:42:08.083 (2083533104)|FATAL_ERROR|System.NullPointerException: Attempt to de-reference a null object

(Zendesk)

I already opened a ticket on Zendesk support, but haven't received an answer yet, and since this is blocking me from deploying things, I decided to try developer forums, maybe someone had the same or similar issue and can give me some hint.

Any ideas?

Regards.


Is it possible to have a page break inside a quote template. What I want is to be able to insert a page break into the layout in order to present other sections in new pages.

 

Thanks for all the help in advance.

We're getting the following error for most of our test methods during deployment in production. All the test methods with this error executed successful in sandbox.

 

Test failure, method: AccountTests.testAfterUpdateTrigger -- Internal Salesforce Error: 1061812497-29679 (778955809) (778955809) stack null

 

Test failure, method: EquipmentControllerTest.test -- Internal Salesforce Error: 1061812497-29681 (778955809) (778955809) stack null

 

Has someone seen this before? Any insights to resolving the issue would be appreciated.

 

Thanks!

ST

 

I'm tryign to help aid some developers on their test class creation in an environment with a lot of cooks in the kitchen.  Things are changing quite often and it's often hard on the test case creation process when fields that weren't required yesterday are required tomorrow etc.

 

So I'm trying to make a simple class that takes in an object type and builds the object for you, checking the objects describe field results to find the fields required.

 

However, in trying to do this one of the parameters I use is checking if the field's isNillable is false.  This worked for some environments but not in others... For example, in one environment account.name was returning a true value for IsNillable but we all know this is not true (and after thinking I lost my mind and tried to do this myself on the backend as a test...I confirmed you can't).

 

Any ideas why it would return true? or does anyone have a sure fire way to detect which fields are required using the schema?

 

Thanks

I'm building a custom wizard for new Opportunities which will also build an initial Quote.  I'm trying to figure out how to leverage the platform's native ability to create Quote Line Items from the parent Opportunity, and I'm a bit stumped. Creating a new Quote doesn't seem to do it automatically. 

 

I looked through the usual resources, the Apex language reference and the Web Services reference, and I am unable to find any documentation on what methods are available on the Quotes object.  Code completion isn't working for me in Eclipse on the Quote object, so that doesn't work either.

 

I've searched this site, and even turned to Google.  Unfortunately 'quote' is a very generic search term, so it hasn't been very helpful.   If anyone can point me to a good resource primer on the Quote object as it exists in Apex, I would be most appreciative.

I would like to sync between opportunity line item and quote line item. I have a few custom fields defined in addition to standard fields in both quote line item and opportunity line item objects. Custom fields in both objects are exact replica. Would the standard sync functionality available help in this? Currently, it doesn't copy over custom fields. I am eager to know, if I can reuse and tweak standard functionality to get this working. Thank you for your help
Message Edited by prakashedl on 03-02-2010 06:57 AM

I am very new to APEX, triggers and classes and trying to create a trigger that will create a new quote record when a new opportunity has been created. (I would like the quote name to be "Quote-"+the opportunity name.)
 
I'm sure this is a very basic code but I am having a hard time getting my bearings straight.
 
Would someone be willing to share how this code would be written.
 
thanks in advance
 
Ben 

I want to make the state/province field required on a lead when a user tries to convert the lead to an account. The state field is not required when the lead is created as the user may not know the state at this point.  When the user is ready to convert a lead the state field needs to be known and populated.  The issue is how to make it required only on the conversion and not on the save. I have thought about validations rules, workflow rules and possibly a trigger.  Though I encounter the problem of the required state error occurs on the save not on the conversion.
  • February 03, 2009
  • Like
  • 0