• Satgur
  • NEWBIE
  • 160 Points
  • Member since 2009

  • Chatter
    Feed
  • 6
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 47
    Replies

I am an ISV and I am integrating a web service into the package I am creating. That web service will need to call back into the user's SF org. Is there a best practice for how to enable this without requiring the user to store his/her password? Is there a best practice paper for how this type of integration should be built?

Hi

 

I'm trying yo write code that generates a string which includes the Month e.g. January.

From the Date object I have the integer representing January (1) but I want the String.

I also wish this string will adopt to the relevant Language.

 

I know I can use Custom Labels and CASE statement but before I do that I want some help, maybe there is a better more native way to achive the same.

 

Thanks

 

 

hi . someone can help me?

 

This is my trigger!

 

trigger preencherResumoPricing on Input_Resumo_Pricing__c (before insert) {

List<Pricing_Produto_Final__c> ppfCNCPC = [select produto__c, preco_de_compra__c,valido_de__c, valido_ate__c,
            Centro_de_Carga2__c from Pricing_Produto_Final__c
            where Tr_background__c = 'Pricing PC Prod Final'];
 
List <Pricing_Produto_Final__c> ppfCNCPV = [select produto__c, PVP_Ref__c, valido_de__c, valido_ate__c
            from Pricing_Produto_Final__c
            where Tr_background__c = 'Pricing PVP Prod Final'];
//buscar a Margem PRIO consoante o produto
List<Parametros_fixos_Pricing__c> pfp_margem =
                    [select produto__c ,margem_prio__c,Valido_ate__c,Valido_de__c,Centro_de_Carga2__c
                    from Parametros_fixos_Pricing__c
                    where tr_background__c = 'Margens PRIO'
                    ];
                        
    for( Input_Resumo_Pricing__c irp : Trigger.new)
    {
        if(irp.tr_background__c == 'Combustíveis não Compostos'){
            for(Pricing_Produto_Final__c ppf : ppfCNCPC ){
                if(irp.valido_de__c ==ppf.valido_de__c && irp.valido_ate__c == ppf.valido_ate__c){
                for(Pricing_Produto_Final__c ppf2 : ppfCNCPV){
                    if(ppf2.produto__c == ppf.produto__c && ppf2.valido_de__c == irp.valido_de__c
                        &&  ppf2.valido_ate__c == irp.valido_ate__c  ){
                        for(Parametros_fixos_Pricing__c margem : pfp_margem){
                        if(margem.produto__c==ppf2.produto__c  && margem.valido_de__c ==irp.valido_de__c
                            &&margem.valido_ate__c== irp.valido_ate__c  &&margem.Centro_de_Carga2__c ==
                            ppf.Centro_de_Carga2__c){
                
           
          
           
           Resumo_Pricing__c resumopricing = new Resumo_Pricing__c();
          resumopricing.produto__c =ppf.produto__c;
          resumopricing.Centro_de_Carga__c =ppf.Centro_de_Carga2__c;
          resumopricing.preco_de_compra__c =ppf.preco_de_compra__c;
          resumopricing.margem_prio__c =margem.margem_prio__c;
          resumopricing.PVP_Referencia_s_Iva__c = ppf2.PVP_Ref__c;
          resumopricing.valido_de__c =irp.valido_de__c;
          resumopricing.valido_ate__c =irp.valido_de__c;
          
          insert resumopricing;
            }}}}}}
           
            
            
            
            
            //Produtos Pricing Manual
           /* List<Pricing_Produto_Final__c> ppfPricManual = [select produto__c, preco_de_compra__c,
            Centro_de_Carga2__c from Pricing_Produto_Final__c
            where Tr_background__c = 'Pricing PC Manual Produto' AND
            valido_de__c = :irp.valido_de__c AND
            Valido_ate__c = :irp.valido_ate__c];
            
          for (Pricing_Produto_Final__c pm : ppfPricManual){
          //buscar a Margem PRIO consoante o produto
                Parametros_fixos_Pricing__c pfp_margem =
                [select margem_prio__c
                from Parametros_fixos_Pricing__c
                where
                tr_background__c = 'Margens PRIO' AND
                produto__c = :pm.produto__c AND
                Centro_de_Carga2__c = :pm.Centro_de_Carga2__c AND
                Valido_ate__c >= :irp.valido_ate__c AND
                Valido_de__c <= :irp.valido_de__c ];
                
          Resumo_Pricing__c resumopricing = new Resumo_Pricing__c();
          resumopricing.produto__c =pm.produto__c;
          resumopricing.Centro_de_Carga__c =pm.Centro_de_Carga2__c;
          resumopricing.preco_de_compra__c =pm.preco_de_compra__c;
          resumopricing.margem_prio__c =pfp_margem.margem_prio__c;
          resumopricing.valido_de__c =irp.valido_de__c;
          resumopricing.valido_ate__c =irp.valido_de__c;
          
          insert resumopricing;
          
          }*/
            
        }else{
            List<Pricing_Produto_Final__c> ppfCCPC = [select produto__c, preco_de_compra__c,
            Centro_de_Carga2__c from Pricing_Produto_Final__c
            where tr_background__c = 'Pricing PC Prod.Final Composto' AND
            valido_de__c = :irp.valido_de__c AND
            Valido_ate__c = :irp.valido_ate__c];
            
            for(Pricing_Produto_Final__c ppf : ppfCCPC ){
            //buscar a Margem PRIO consoante o produto
                Parametros_fixos_Pricing__c pfp_margem2 =
                [select margem_prio__c
                from Parametros_fixos_Pricing__c
                where
                tr_background__c = 'Margens PRIO' AND
                produto__c = :ppf.produto__c AND
                Centro_de_Carga2__c = :ppf.Centro_de_Carga2__c AND
                Valido_ate__c >= :irp.valido_ate__c AND
                Valido_de__c <= :irp.valido_de__c ];
                
           Pricing_Produto_Final__c ppfCC = [select produto__c, PVP_Ref__c from Pricing_Produto_Final__c
            where tr_background__c = 'Pricing PVP Prod.Final Composto' AND
            produto__c = :ppf.produto__c AND
            valido_de__c = :irp.valido_de__c AND
            Valido_ate__c = :irp.valido_ate__c];
            
           Resumo_Pricing__c resumopricing = new Resumo_Pricing__c();
          resumopricing.produto__c =ppf.produto__c;
          resumopricing.Centro_de_Carga__c =ppf.Centro_de_Carga2__c;
          resumopricing.preco_de_compra__c =ppf.preco_de_compra__c;
          resumopricing.margem_prio__c =pfp_margem2.margem_prio__c;
          resumopricing.PVP_Referencia_s_Iva__c =ppfCC.PVP_Ref__c;
          resumopricing.valido_de__c =irp.valido_de__c;
          resumopricing.valido_ate__c =irp.valido_ate__c;
          
          insert resumopricing;
            }
        }

    }
}

Hi,

I am writing "send e-mail program" using sendEmail method.

 

I want to see error message about failure of sending e-mail.

 

How can I make e-mail to be failure ?

  • August 17, 2010
  • Like
  • 0

Hi,

 

As you all know Salesforce is phasing out s-control next year, so I am given the task to convert one functionality written in S-control to VF page.

 

My object is select more then 10000 records from the object (lets say my object 30000 records). Even consider by applying all filter criteria SOQL still need to fetch more than 10000 rows.

 

But when I try to select more then 10000 records using SOQL, apex throw a limit exception to me.

So any idea how we can select more then 10000 records in VF/Apex solution.

 

Any suggestion is appreciable.

 

Thanks

Rajan

For external webservice callouts there is a read timeout of 10 seconds. Is there a way to change this timeout?

Has anyone worked in developing a typical Web Portal kind HOME page within SFDC?

 

We are trying to figure out best way to design this solution which should show multiple subsections within home page

1. One widget for Chatter feed

2. another widget for my alerts

3. one subsection for showing document links pertaining to User role in org

 

This is not hard coded VF but each application user should be able to personalize this page as per his/her preferences, not limited to below

 

1. Choosing which widget to add in their HOME page view

2. Choosing placement of Widget on HOME page (top left, bottom right)

3. Skins and Themes of HOME page

 

If anyone has done something similar and can share relevant experience as to how they handled it, any roadblock faced etc, it will be greatly helpful.

 

Thanks

Satgur

 

  • March 15, 2012
  • Like
  • 0

Hi,

 

Our client is looking for a consolidated Search page for end users, whereby User can query once and implementation should search SFDC entire org for matching records.

 

Search should encompass below :

1. Documents (full text search inside document content)

2. Chatter files (full text search inside file content)

3. Content documents (full text search inside document content)

4. Chatter feed

5. SFDC entities (account, contact etc)

6. Any Static Visualforce pages defined within the org (like any other web site which has a site page containing some key information)

 

The benefit is that -

1. No need to go to different tabs to do document search (chatter file, Content tab, Document tab, SFDC global search). and User can run search from a single place.

 

2. Whole search and results display can be customized to present information in a consistent and user friendly manner in line with industry standards (Google search results).

 

Does anyone have any recommendation about leveraging Visualforce/Apex to develop this universal search page in SFDC?

Any limitation esp. - 2 which come to mind

 

Questions

(i) With VF, how can we perform full text document content searches? I guess it is possible in standard SFDC (search within Chatter file, Content tabs).

(ii) Can we do a search on Visualforce page content itself and show this in results?

(iii) Any AppExchange solutions which can help with this requirement?

 

Appreciate recommendations and how can we satisfy all requirements using Visualforce approach.

 

Thanks

Satgur

 

 

 

 

 

  • March 01, 2012
  • Like
  • 0

Scenario - We are trying to setup a framework for Scheduler and BatchApex classes, whereby it will be possible to define (inside a custom object or custom setting) - list of Apex Class names (batch apex classes) and the order in which they should be executed.

 

These custom settings can be modified by Administrator so BatchApex3.class may need to be run first and BatchApex1.class after it. So we are defining BatchApex class names declaratively inside a custom setting.

 

Query - The real question here is, like what we do in Java using System.getRunTime().exec(STRING) to instantiate and run any Java class file at runtime, can we achieve similar with Apex (force.com) realm??

 

or if you think we can achieve the requirement stated above using other means, do share your thoughts or suggestions.

 

 

 

- Best

Satgur

  • December 09, 2010
  • Like
  • 0

Hi,

 

Not sure if Salesforce would allow this (knowing all cross-domain javascript restrictions coming into play et.) but is it possible to somehow enforce a whole browser page refresh from an inline Visualforce page (i.e. an embedded VF within Standard page)?

 

This is needed since the inline VF page captures data for one of the CHILD objects (Opportunity standard page having sub-section for OpportunityLineItem data).

 

Hence whenever we add a new Opportunity Line item using this inline vF page, there are some rollup calculations happening on parent i.e. Opportunity and since those roll up fields are present on Opportunity Standard page, only way for us to show latest information on UI is to somehow cause whole page to refresh so that Opportunity shows updated roll up fields, as well as Inline VF shows new line item added. 

 

I am bit skeptical about this as we have seen issues in past where VF are rendered from a separate domain and standard pages from different, hence cross-domain JS issues may arise here if we try to refresh PARENT using  javascript within Inline VF.

 

I saw a similar post but not sure how we can do whole brower refresh -

http://community.salesforce.com/t5/Visualforce-Development/Refresh-related-list-based-on-inline-visualforce-page/m-p/186161/highlight/false#M24759

 

Any insight, help is appreciated.

 

Thanks

Satgur

Is there any configuration option to specify default value for STAGENAME field (label - Stage) in Opportunity? What if a particular Sales Process demands all new opportunity records to have a pre-default STAGENAME value?

 

We do understand that Picklist values (for STAGENAME field) are driven by SALES PROCESS + RECORD TYPE that Opportunity transaction is part of. But we may still want to use defaulting options for given sales prcess.

 

Appreciate if you can share your way of dealing with this in case you implemented a similar requirement before.

 

Thanks

Satgur

 

 

 

I have signed up for Summer 09 pre-release.

 

Since preview release note mention that latest force.com IDE (summer 09) can now work with Eclipse 3.4 as well.

 

I did install Eclispe 3.4 and installed Force.com IDE plug-in. 

 

But I can fetch only 15.0.2 (Spring'09 April 2009 release), using http://www.adnsandbox.com/tools/ide/install/ as the remote site for fetching new release of the plug-in.

 

Appreciate if you can guide as to whether I need to continue using CONSOLE for all development in Summer 09 pre-release or I can test latest force.com IDE features (which is now Eclipse 3.4 compatible) as part of Summer 09 release exploration.

 

- Satgur 

Hi,

As we know, starting next year Salesforce will stop providing option to write/develop new s-controls in the org. This is part of the product roadmap where s-control becomes an obsolete technology moving forward.

 

Does Salesforce have a recommendation on the replacement options of existing s-controls that are working today? As s-controls nears EOL (end of life) stage, even older s-controls will have to be retired and converted into an alternate technology like Visualforce.

 

1) I wanted to check with peers in this forum, if you are aware of any recommended approaches to migrate or replace s-control code.

 

2) One of the pattern that has started emerging (at least this is what I notice with some of our customers where we have lot of non-UI s-controls doing batch kind of processing) - bulk of the processing within s-control, mostly dealing with SOQL & DML operations, has been moved to APEX class and exposed as a Web Service.

 

existing s-controls becomes lightweight and invokes APEX web service for main business logic.

 

In this case, since most of logic has already been shifted out of s-control we can easily get rid of such s-controls by using inline Javascript option and whatever little processing is being done in s-control (showing alerts to user etc), that can be accommodated in inline Java script and hence practically doing away with s-control.

 

So we can see below pattern, as a  phased approach for retiring s-control :

 

A) custom link on page --> invokes s-control --> API calls to server

B) custom link on page --> invokes trimmed down s-control --> calls APEX web service --> Database calls

C) custom link on page --> inline JavaScript code --> calls APEX web service --> database calls

 

Would like to invite comments on above approach (works with non-UI, batch process s-contols) from experienced s-controls developers to validate if solution (C) will work equally fine.  

 

Important --> Remember we continue to use/refer to "connection.js" & "apex.js" in option C (inline javascript) as well. Since this is part of AJAX toolkit, I believe retirement of s-controls from the scene isn't going to impact the way we work with AJAX toolkit in future.

 

3) For bulk data processing s-controls, we can't think of replacing it with Visualforce as APEX governor limits constraints starts applying. In s-controls, we had the flexibility to batch and process records so we can work around these governor limits. For that matter any client application on force.com API doesn't have restriction on governor limits.

 

So question is how do we handle such cases? What can be a possible retirement strategy? VF+FLEX mashup? 

 

Appreciate your comments, suggestions.

 

 

Thanks

Satgur

  • February 25, 2009
  • Like
  • 0

Has anyone worked in developing a typical Web Portal kind HOME page within SFDC?

 

We are trying to figure out best way to design this solution which should show multiple subsections within home page

1. One widget for Chatter feed

2. another widget for my alerts

3. one subsection for showing document links pertaining to User role in org

 

This is not hard coded VF but each application user should be able to personalize this page as per his/her preferences, not limited to below

 

1. Choosing which widget to add in their HOME page view

2. Choosing placement of Widget on HOME page (top left, bottom right)

3. Skins and Themes of HOME page

 

If anyone has done something similar and can share relevant experience as to how they handled it, any roadblock faced etc, it will be greatly helpful.

 

Thanks

Satgur

 

  • March 15, 2012
  • Like
  • 0

I am an ISV and I am integrating a web service into the package I am creating. That web service will need to call back into the user's SF org. Is there a best practice for how to enable this without requiring the user to store his/her password? Is there a best practice paper for how this type of integration should be built?

Hi,

I m using a standard controller for my custom object

i want my object's field values to be displayed on visualforce page.

 

<apex:page showHeader="false" standardStylesheets="false" standardController="Project__c" recordSetVar="ProjectID">
<apex:form >
<apex:pageBlock title="Project Details ">
<apex:pageBlockSection>
<apex:inputField value="{!Project__c.Project_Description__c}"/>
<apex:inputField value="{!Project__c.Maintainance_Type__c}"/>
<apex:inputField value="{!Project__c.Registration_Date__c}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

 

here project description is a text field.

i want data of this field to be displayed on visualforce page in text box.

Hello,

When I add a table column related to a currency field, VisualForce automatically formats the rows with the currency symbol and number separators. For example:

<apex:pageBlockTable value="{!CustomObject__c}" var="varname">
	<apex:column value="{!varname.Custom_Currency_Field__c}"/>
</apex:pageBlockTable>

I couldn't find out what currency format does it use (associated with the browser or user's language, for example). I changed my Location in My Personal Information but the currency format in the VF page didn't change, so I guess it's not related to the user's settings. I wonder if anyone knows how to set the currency format. I found a lot of examples to manually format the output field, but that's not what I need, I need something similar to the Translation Workbench feature, that translates my customizations to the user's language. I want to know if is there a stantard function that "translates" the currency, or if I can achieve this through the Force.com IDE and the Translation Workbench.

Thanks

Hello,

 

I have changed the RecordType of a record through Apex trigger code as :

 

 RecordType rtPost = [select Id from RecordType where Name = 'Post-acceptance' and SobjectType = 'Placement__c'];

placement.RecordTypeId = rtPost.id;

 

The above mentioned code lines are running successfully with no errors but while testing through UI, the look and feel of the record doesnt gets changed, instead the debug log shows that the changed value of recordtype is assigned to the RecordTypeId field.

 

I dont know how to verify that the recordType of the record is changed or not through UI.

 

Anyone can help me?

 

Thanks

 

The logic we need to have to update these 2 fields are:

 

  • If the Next PM Date is in the current month (e.g. incoming inspections):

o   Set Last Scheduled date equal to today’s date

o   If Effective PM Schedule Type = fixed, Set Next PM date equal to the newly calculated Last Scheduled date + Effective frequency

  • If the Next PM Date is before the current month (e.g. regularly scheduled PM’s):

o   Set Last Scheduled date equal to today’s date+ 1 month (because that’s when the PM will actually be due)

o   Again, if Effective PM Schedule Type = fixed, set Next PM date equal to the newly calculated Last Scheduled date + Effective frequency

global class createPMWorkOrder implements Database.Batchable<sObject>{
    
    public String query;
    
    //Override start method of Database.Batchable interface
    global Database.QueryLocator start(Database.BatchableContext BC){
        //Get Current Date
        date currentDate = Date.today();

        date periodStart;
     
        date periodEnd;
        
        //****Calculate Period Start and End Dates
        if(currentDate.month() == 12)
            periodStart = date.newInstance(currentDate.year()+1, 1, 1);
        else
            periodStart = date.newInstance(currentDate.year(), currentDate.month()+1, 1);
        //periodStart = Date.today()-1;
        periodEnd = periodStart.addMonths(1) - 1;
            
        /****Create a query for retrieving all the fields required for creating a work order
             using the conditions Next_PM_Date__c is between Period Start and End Dates and Asset is active?*/
        //String returnQuery = 'Select id, Facility__c, Primary_FSE__c, PM_Plan__c, Next_PM_Date__c, Effective_PM_Frequency__c, Last_Completed_PM_Date__c, Last_Scheduled_PM_Date__c, Facility__r.OwnerId from MVS_Asset__c where (Next_PM_Date__c >= :periodStart and Next_PM_Date__c <= :periodEnd) and Status__c = \'Active\'';
        
        return Database.getQueryLocator(query);
    }
    
    //Override execute method of Database.Batchable interface
    global void execute(Database.BatchableContext BC, List<MVS_Asset__c> assets){

        List<Case> pmWorkOrders = new List<Case> ();
        List<MVS_Asset__c> mvsAssetList = new List<MVS_Asset__c>();
        
        //Get Record Type ID of Preventative Maintenance
        RecordType RecType = [select id from RecordType where name = 'Preventative Maintenance' and SobjectType = 'Case'];
        
        //Create Work Orders for all the assets in the context
        for (MVS_Asset__c mvsAsset : assets){
            //Determine Work Order Owner
            Id workOrderOwner = mvsAsset.Primary_FSE__c;
            if (workOrderOwner == null){
                workOrderOwner = mvsAsset.Facility__r.OwnerId;
            }
            
            //Initiate a Work Order
            Case pmWorkOrder = new Case (   OwnerId = workOrderOwner,
                                            MVS_Asset__c = mvsAsset.Id,
                                            AccountId = mvsAsset.Facility__c,
                                            Status = 'Open',
                                            Priority = 'Schedule Activity',
                                            RecordTypeId = RecType.Id);
            //Add Work Order to the list                                
            pmWorkOrders.add(pmWorkOrder);
            
            //Assigning the List values to variables for better performance
            //date lastScPMDate = mvsAsset.Last_Scheduled_PM_Date__c;
            //date nextPMDate = mvsAsset.Next_PM_Date__c;
            //date lastComPMDate = mvsAsset.Last_Completed_PM_Date__c;
            String effectivePMFreq = mvsAsset.Effective_PM_Frequency__c;
            
            //Assign Last Scheduled PM Date to Next PM Date
            //mvsAsset.Last_Scheduled_PM_Date__c = mvsAsset.Next_PM_Date__c;
            
            mvsAsset.Last_Scheduled_PM_Date__c = System.today();

            Integer effPMFrequency = 0;
            if (effectivePMFreq != 'Manufacturer\'s Recommendation' && effectivePMFreq!='Not Required')
                effPMFrequency = decimal.valueOf(effectivePMFreq).intValue();
            
            //Calculate Next PM Date    
            if (mvsAsset.Effective_PM_Schedule_Type__c == 'Float')
                mvsAsset.Next_PM_Date__c = null;
            else{
                mvsAsset.Next_PM_Date__c = System.today().addMonths(effPMFrequency);
            }
                
            mvsAsset.Outstanding_PM_Work_Order__c = true;
            /*if (mvsAsset.PM_Schedule_Type__c == 'Floating'){
                if(mvsAsset.Last_Completed_PM_Date__c != null)
                    mvsAsset.Next_PM_Date__c = mvsAsset.Last_Completed_PM_Date__c.addMonths(effPMFrequency);
                else
                    mvsAsset.Next_PM_Date__c = nextPMDate.addMonths(effPMFrequency);
            }
            else{
                if(lastScPMDate != null)
                    mvsAsset.Next_PM_Date__c = lastScPMDate.addMonths(effPMFrequency);
                else
                    mvsAsset.Next_PM_Date__c = nextPMDate.addMonths(effPMFrequency);
            }*/
            
 if ( mvsAsset.Next_PM_Date__c == currentDate.month)
                        mvsAsset.Last_Scheduled_PM_Date__c = System.today();
                     
 if ( mvsAsset.Next_PM_Date__c == currentDate.month)                        mvsAsset.Last_Scheduled_PM_Date__c = System.today();                      mvsAssetList.add(mvsAsset); } System.debug('*******************************Updating MVS Asset'); //Insert all new Work Orders update mvsAssetList; System.debug('*********************************Inserting Work Orders'); insert pmWorkOrders; } //Override finish method of Database.Batchable interface global void finish(Database.BatchableContext BC){ } }

 i am trying the above highlited code.. i am getting error

 

kindly help

 

Scenario - We are trying to setup a framework for Scheduler and BatchApex classes, whereby it will be possible to define (inside a custom object or custom setting) - list of Apex Class names (batch apex classes) and the order in which they should be executed.

 

These custom settings can be modified by Administrator so BatchApex3.class may need to be run first and BatchApex1.class after it. So we are defining BatchApex class names declaratively inside a custom setting.

 

Query - The real question here is, like what we do in Java using System.getRunTime().exec(STRING) to instantiate and run any Java class file at runtime, can we achieve similar with Apex (force.com) realm??

 

or if you think we can achieve the requirement stated above using other means, do share your thoughts or suggestions.

 

 

 

- Best

Satgur

  • December 09, 2010
  • Like
  • 0

Hi

 

I'm trying yo write code that generates a string which includes the Month e.g. January.

From the Date object I have the integer representing January (1) but I want the String.

I also wish this string will adopt to the relevant Language.

 

I know I can use Custom Labels and CASE statement but before I do that I want some help, maybe there is a better more native way to achive the same.

 

Thanks

 

 

I have two approval processses set up that are identical except for the object type that they service. I have code that submits files for, and recalls files from, the two approval processes. The APEX is the same for both classes (except for the different object). The test code is the same (except for the different object). Because I trap the MANAGER_NOT_FOUND error in my code, I create two users to run my tests under - one with a designated approver and one without. I use runas for this.

 

When I run my test code, I get the same result regardless of which user I was running under, which is definitely wrong, AND one object always hits the exception and the other never does. This is a double nonsense result.

 

Anyone have experience with this?

 

Mauricio

  • September 01, 2010
  • Like
  • 0

hi . someone can help me?

 

This is my trigger!

 

trigger preencherResumoPricing on Input_Resumo_Pricing__c (before insert) {

List<Pricing_Produto_Final__c> ppfCNCPC = [select produto__c, preco_de_compra__c,valido_de__c, valido_ate__c,
            Centro_de_Carga2__c from Pricing_Produto_Final__c
            where Tr_background__c = 'Pricing PC Prod Final'];
 
List <Pricing_Produto_Final__c> ppfCNCPV = [select produto__c, PVP_Ref__c, valido_de__c, valido_ate__c
            from Pricing_Produto_Final__c
            where Tr_background__c = 'Pricing PVP Prod Final'];
//buscar a Margem PRIO consoante o produto
List<Parametros_fixos_Pricing__c> pfp_margem =
                    [select produto__c ,margem_prio__c,Valido_ate__c,Valido_de__c,Centro_de_Carga2__c
                    from Parametros_fixos_Pricing__c
                    where tr_background__c = 'Margens PRIO'
                    ];
                        
    for( Input_Resumo_Pricing__c irp : Trigger.new)
    {
        if(irp.tr_background__c == 'Combustíveis não Compostos'){
            for(Pricing_Produto_Final__c ppf : ppfCNCPC ){
                if(irp.valido_de__c ==ppf.valido_de__c && irp.valido_ate__c == ppf.valido_ate__c){
                for(Pricing_Produto_Final__c ppf2 : ppfCNCPV){
                    if(ppf2.produto__c == ppf.produto__c && ppf2.valido_de__c == irp.valido_de__c
                        &&  ppf2.valido_ate__c == irp.valido_ate__c  ){
                        for(Parametros_fixos_Pricing__c margem : pfp_margem){
                        if(margem.produto__c==ppf2.produto__c  && margem.valido_de__c ==irp.valido_de__c
                            &&margem.valido_ate__c== irp.valido_ate__c  &&margem.Centro_de_Carga2__c ==
                            ppf.Centro_de_Carga2__c){
                
           
          
           
           Resumo_Pricing__c resumopricing = new Resumo_Pricing__c();
          resumopricing.produto__c =ppf.produto__c;
          resumopricing.Centro_de_Carga__c =ppf.Centro_de_Carga2__c;
          resumopricing.preco_de_compra__c =ppf.preco_de_compra__c;
          resumopricing.margem_prio__c =margem.margem_prio__c;
          resumopricing.PVP_Referencia_s_Iva__c = ppf2.PVP_Ref__c;
          resumopricing.valido_de__c =irp.valido_de__c;
          resumopricing.valido_ate__c =irp.valido_de__c;
          
          insert resumopricing;
            }}}}}}
           
            
            
            
            
            //Produtos Pricing Manual
           /* List<Pricing_Produto_Final__c> ppfPricManual = [select produto__c, preco_de_compra__c,
            Centro_de_Carga2__c from Pricing_Produto_Final__c
            where Tr_background__c = 'Pricing PC Manual Produto' AND
            valido_de__c = :irp.valido_de__c AND
            Valido_ate__c = :irp.valido_ate__c];
            
          for (Pricing_Produto_Final__c pm : ppfPricManual){
          //buscar a Margem PRIO consoante o produto
                Parametros_fixos_Pricing__c pfp_margem =
                [select margem_prio__c
                from Parametros_fixos_Pricing__c
                where
                tr_background__c = 'Margens PRIO' AND
                produto__c = :pm.produto__c AND
                Centro_de_Carga2__c = :pm.Centro_de_Carga2__c AND
                Valido_ate__c >= :irp.valido_ate__c AND
                Valido_de__c <= :irp.valido_de__c ];
                
          Resumo_Pricing__c resumopricing = new Resumo_Pricing__c();
          resumopricing.produto__c =pm.produto__c;
          resumopricing.Centro_de_Carga__c =pm.Centro_de_Carga2__c;
          resumopricing.preco_de_compra__c =pm.preco_de_compra__c;
          resumopricing.margem_prio__c =pfp_margem.margem_prio__c;
          resumopricing.valido_de__c =irp.valido_de__c;
          resumopricing.valido_ate__c =irp.valido_de__c;
          
          insert resumopricing;
          
          }*/
            
        }else{
            List<Pricing_Produto_Final__c> ppfCCPC = [select produto__c, preco_de_compra__c,
            Centro_de_Carga2__c from Pricing_Produto_Final__c
            where tr_background__c = 'Pricing PC Prod.Final Composto' AND
            valido_de__c = :irp.valido_de__c AND
            Valido_ate__c = :irp.valido_ate__c];
            
            for(Pricing_Produto_Final__c ppf : ppfCCPC ){
            //buscar a Margem PRIO consoante o produto
                Parametros_fixos_Pricing__c pfp_margem2 =
                [select margem_prio__c
                from Parametros_fixos_Pricing__c
                where
                tr_background__c = 'Margens PRIO' AND
                produto__c = :ppf.produto__c AND
                Centro_de_Carga2__c = :ppf.Centro_de_Carga2__c AND
                Valido_ate__c >= :irp.valido_ate__c AND
                Valido_de__c <= :irp.valido_de__c ];
                
           Pricing_Produto_Final__c ppfCC = [select produto__c, PVP_Ref__c from Pricing_Produto_Final__c
            where tr_background__c = 'Pricing PVP Prod.Final Composto' AND
            produto__c = :ppf.produto__c AND
            valido_de__c = :irp.valido_de__c AND
            Valido_ate__c = :irp.valido_ate__c];
            
           Resumo_Pricing__c resumopricing = new Resumo_Pricing__c();
          resumopricing.produto__c =ppf.produto__c;
          resumopricing.Centro_de_Carga__c =ppf.Centro_de_Carga2__c;
          resumopricing.preco_de_compra__c =ppf.preco_de_compra__c;
          resumopricing.margem_prio__c =pfp_margem2.margem_prio__c;
          resumopricing.PVP_Referencia_s_Iva__c =ppfCC.PVP_Ref__c;
          resumopricing.valido_de__c =irp.valido_de__c;
          resumopricing.valido_ate__c =irp.valido_ate__c;
          
          insert resumopricing;
            }
        }

    }
}

I am a little stuck with a page I am trying to create.

 

Basically, I am trying to create a collection of apartment records related to a building parent record. I then want to split this list into the different building levels/floors. Using this data, I want to construct a table on my VF page such that each row represents a floor and each cell represents an individual apartment. 

 

Any suggestions on where to start with this would be greatly appreciated.

 

Thanks in advance.

 We need to execute a query on behalf of another user.

 

Ex: User creates an Action Item record (think of it as question to the field force), the question needs to apply only to Accounts accessible to the user. To do so we have an intermediate object, ActionItemAccount.

 

ActionItemAccount is refreshed nightly to reflect any changes in the users's access overtime. 

The batch Deletes existing records, and recreates records based on the currently accessible to the user Accounts.

To do so the batch needs to query the Account object (Run As) the Owner of the Action Item.

 

Hope the above makes sense, can you please share your thoughts on the desired approach,

 

thank you,

A. 

  • August 16, 2010
  • Like
  • 0

Currently, I am working on a POV for one of my customer.

I have a webservice hosted by a third party provider and I try to invoke this web service. So I have loaded the WSDL into Force.com (including SOAP Headers and SOAP Faults) and the APEX calsses has been created. This is working fine as long as I do not recieved a SOAP fault.

 

When the Web Service is returning a SOAP Fault, a callout exception is generated. I try to find a way to get that SOAP fault in the associated object genereted automatically but I cannot find how.

 

Is there a way to get the SOAP Fault into the SOAP Fault object generated when importing the WSDL? If not is there at least a way to retrieve to full SOAP message that was recieved?

 

Thanks

Karolinski Stéphane

I have an @future method that runs to reassign open approval requests based on Out of office rules.  If I don't have the method decorated @future - I have no issues everything works fine.  But if I decorate the method @future - i get a NullReference exception 

 

 

System.DmlException: Update failed. First exception on row 0 with id 04iXXXXXXXXXXXXXXX; first error: UNKNOWN_EXCEPTION, java.lang.NullPointerException: Argument Error: Parameter value is null: []

 

The only thing that changed is the @future decorator.  I would like to use this in Code Scheduler - but I also get the same error.  Anyone worked around this?

 

 

 

  • August 13, 2010
  • Like
  • 0

Hi,

 

Not sure if Salesforce would allow this (knowing all cross-domain javascript restrictions coming into play et.) but is it possible to somehow enforce a whole browser page refresh from an inline Visualforce page (i.e. an embedded VF within Standard page)?

 

This is needed since the inline VF page captures data for one of the CHILD objects (Opportunity standard page having sub-section for OpportunityLineItem data).

 

Hence whenever we add a new Opportunity Line item using this inline vF page, there are some rollup calculations happening on parent i.e. Opportunity and since those roll up fields are present on Opportunity Standard page, only way for us to show latest information on UI is to somehow cause whole page to refresh so that Opportunity shows updated roll up fields, as well as Inline VF shows new line item added. 

 

I am bit skeptical about this as we have seen issues in past where VF are rendered from a separate domain and standard pages from different, hence cross-domain JS issues may arise here if we try to refresh PARENT using  javascript within Inline VF.

 

I saw a similar post but not sure how we can do whole brower refresh -

http://community.salesforce.com/t5/Visualforce-Development/Refresh-related-list-based-on-inline-visualforce-page/m-p/186161/highlight/false#M24759

 

Any insight, help is appreciated.

 

Thanks

Satgur

Is there any configuration option to specify default value for STAGENAME field (label - Stage) in Opportunity? What if a particular Sales Process demands all new opportunity records to have a pre-default STAGENAME value?

 

We do understand that Picklist values (for STAGENAME field) are driven by SALES PROCESS + RECORD TYPE that Opportunity transaction is part of. But we may still want to use defaulting options for given sales prcess.

 

Appreciate if you can share your way of dealing with this in case you implemented a similar requirement before.

 

Thanks

Satgur

 

 

 

Hi,

 

How can I refresh my particular related list based on certain action I perform on inline visualforce page?

 

I have inline VF page on Account Object and based on click of link on it, I insert record in one object. I only want to refresh

 

that inline VF page and related list of the object in which I inserted the record. I can refresh inline VF but how to refresh

 

specific related list? I am trying with rerender option but not getting Id of the specific related list on the page.

 

Thanks

- Kunjan