• Chris Gary
  • NEWBIE
  • 40 Points
  • Member since 2014
  • Developer
  • EnablePath


  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 9
    Replies
I have a SOQL in an extended controller that supports a visualforce page. I want to make sure the result only contains one record and is not null. May need to remove the LIMIT 1 entry because I want to make sure there is truly only one record to prevent dirty data from propogating . If eeither of the two conditions are discovered (more than one record or null) then I want to write an error message to the visualforce message component. 

Below is my extended contoller. Any examples would bee apprecciated. 
 
public with sharing class ParentChildExtensionAUTOsample {

/*
This code supports the PROD_Audiit_Auto_PolicySample visualforce page.
FUNCTION:
Receives parent ID (accID) passed via commandbutton or custom button on parent related list.
AccId must be passed via URL since we are instantiating a new object reccord which is not saved.
accID is needed to query parent fields that are used on the visualforce page for rendering.
A non list object is used for the SOQL query to the parent. The result set is used in the visualforce page for setting control variables for rendering. 
* we are always passing the parent ID to this query and using LIMIT=1 per salesforce best practices. 
The parent ID is loaded into the related list field on the instanitated object to establish relationship when saved. 
*/

public Audit__c audit{get;set;}
Auto_Audit_Sample_Policy__c record;

String accId;
@TestVisible private Apexpages.StandardController controller; 

public ParentChildExtensionAUTOsample(ApexPages.StandardController standardController)
{
//set sample to current record.
this.record = (Auto_Audit_Sample_Policy__c)standardController.getrecord();
//grab AccID passed in from URL
accID=ApexPages.currentPage().getParameters().get('AccId');
  
 audit= [SELECT Id, Name, Policy_Information__c, Policy_Number__c, Prior_Carrier__c, Expiring_Premium__c, Reinstatement_Information__c, Insured_Location__c, Agent_Information__c, Agent_City__c, Agent_Name__c, 
    Driver_Information__c, Age__c, Gender__c, Marital_Status__c, Named_Insured_Add_Driver__c, Occupation__c, Business_Use__c, Vehicle_Information__c, Model_Year__c, Vehicle_Type__c, ISO_Symbol__c     
    FROM Audit__c WHERE Id = :ApexPages.currentPage().getParameters().get('AccId') LIMIT 1];

//Load the parent Name (ID) into the Audit field. 
record.Audit__c = audit.Id;
}
}

 
Hello!

I am attempting to mirror a specific process for generating an hmac (using SHA-256) that is currently being done in Python.

The problem is as follows,

1) In Python - you have a two step process for generating an hmac/signature
2) First step - you initialize a new hmac object with your secret key
3) Second step - you call an UPDATE method with the specific string you want to use for your signature (see example below)
# Create a HMAC-SHA256 instance and initialize it with your secret 
hmac = hmac.new("yoursecretkey", digestmod=hashlib.sha256)
# Update the instance with your sig string
hmac.update("yourinputstring")
sig = hmac.hexdigest()
4) You then can call hmac.hexdigest and get a hex encoded signature

The problem is - in Salesforce, there is a single method, Crypto.generateMac, that takes three arguments:

a) The algorithm (sha-256)
b) The input string
c) Your secret key

Running this method with the same string/secret key will net out a different result than running the process in Python.

I don't know enough about hmac/SHA-256 to know what the hmac.new vs hmac.update methods are doing - but I'm hoping to reproduce the process and get the same results in Salesforce.

Any help/thoughts you could provide would be very helpful
Greeting:

We have been on a project for a client with a low budget and we want to roll out existing and free salesforce features to accomodate with one of the requirements.

The client would like to expose their change management app to each and every one of their customers, and allow them to create and update records in their (our client) system.

The client would prefer not to rollout customer community.
We are to leverage either Force.com Sites or Site.com Sites (force.com is our first choice for site.com with require external Domain or active Community) to achieve this.

At this point, I would like to specify this to my first force.com/site.com implementation and would like inputs/recommendations.

Request: How does one restrict public access to a Force.com Site and only allows selective users?

Fact the client's org is new (therefore portals are not feature options)
Assume IP restriction will not apply as a security layer.
Assume Customer data is sensitive and can only be viewed by customers and each customer can only view their own data. 

Can the above request be satisfied at low cost with a combinaiton free features or licenced features or a combination of both?

Thank you all in advance.
I've been struggling to deliver a (good) user experience on an existing Force.com Sites implementation where we want to add in a public knowledge base.  So far, I've hit roadblock after roadblock in being able to do this without doubling the administrative burden in managed FDC administration.  Here's where I'm at, I'm hoping I'm just missing something trivial and not multiple design flaws:

PKB
  • PKB doesn't seem to be supported any more.  It's an unmanaged package, which means that even if there we updates, they are extremely hard to integrate into a custom-styled FDC website.
  • PKB will not render articles if it is configured to use a Force.com site with a URL Rewriter.  It uses an undocumented page renderer/API to render the articles.  This means that you would have to put PKB in a separate FDC Site if your main site requires the use of a URL Rewriter (and many do, for SEO).

Chatter Answers in a public Force.com site
  • The administrative setup for this was atrocious.  Back and forth over dozens of Setup Area UI screens, some of which had to be visited/edited multiple times just by following the implementation guide from top to bottom.  And that's after already having set up all the the Knowledge dependencies while implementing PKB in the same SF Org.
  • When enabling a Chatter Answers zone to "bind" to a Force.com site, it actually creates a NEW Force.com site loosely tied to the original one.  The issue with this approach, is that it requires a different cookie domain (which breaks transitioning logged in users in and out of the Chatter Answers pages).  It also requires the admin to set up identical settings for the main FDC Site AND this newly created site, including the FDC Site Settings, Public Access Settings, Login Access Settings, etc.  Nightmare.
I'm hoping I'm missing something here, but after literally days of configuring both of these, each, all I can see is a complete disregard for a user experience allowing a developer to deliver these solutions alongside an existing Sites implementation in a way that will be acceptable.
 
I have a SOQL in an extended controller that supports a visualforce page. I want to make sure the result only contains one record and is not null. May need to remove the LIMIT 1 entry because I want to make sure there is truly only one record to prevent dirty data from propogating . If eeither of the two conditions are discovered (more than one record or null) then I want to write an error message to the visualforce message component. 

Below is my extended contoller. Any examples would bee apprecciated. 
 
public with sharing class ParentChildExtensionAUTOsample {

/*
This code supports the PROD_Audiit_Auto_PolicySample visualforce page.
FUNCTION:
Receives parent ID (accID) passed via commandbutton or custom button on parent related list.
AccId must be passed via URL since we are instantiating a new object reccord which is not saved.
accID is needed to query parent fields that are used on the visualforce page for rendering.
A non list object is used for the SOQL query to the parent. The result set is used in the visualforce page for setting control variables for rendering. 
* we are always passing the parent ID to this query and using LIMIT=1 per salesforce best practices. 
The parent ID is loaded into the related list field on the instanitated object to establish relationship when saved. 
*/

public Audit__c audit{get;set;}
Auto_Audit_Sample_Policy__c record;

String accId;
@TestVisible private Apexpages.StandardController controller; 

public ParentChildExtensionAUTOsample(ApexPages.StandardController standardController)
{
//set sample to current record.
this.record = (Auto_Audit_Sample_Policy__c)standardController.getrecord();
//grab AccID passed in from URL
accID=ApexPages.currentPage().getParameters().get('AccId');
  
 audit= [SELECT Id, Name, Policy_Information__c, Policy_Number__c, Prior_Carrier__c, Expiring_Premium__c, Reinstatement_Information__c, Insured_Location__c, Agent_Information__c, Agent_City__c, Agent_Name__c, 
    Driver_Information__c, Age__c, Gender__c, Marital_Status__c, Named_Insured_Add_Driver__c, Occupation__c, Business_Use__c, Vehicle_Information__c, Model_Year__c, Vehicle_Type__c, ISO_Symbol__c     
    FROM Audit__c WHERE Id = :ApexPages.currentPage().getParameters().get('AccId') LIMIT 1];

//Load the parent Name (ID) into the Audit field. 
record.Audit__c = audit.Id;
}
}

 
I want to get data from external system by calling it's Web Service. And insert records in Salesforce with that data.
Now, the problem is there is limit of 10 Web Service call outs per Transaction. But in my scenario I have to create a Scheulable which will do too many call outs. (say 500 Web Service call outs). Like for each Account I want to get Billing Details for that account. So, in request I will be sending Account Details and in response I will be getting Billing Details for that account. So, if there are 500 accounts for which I have to get billing details then I have to call Web Service 500 times.
It has to be programmatic, not through CSV file, Data Loader, etc.

Is it even doable?
Hi All,

I have a very frustrating refresh issue that I've been trying to figure out and I've gotten nowhere.

Essentially, I'm coding for the service cloud console where my components are custom visualforce pages leveraging the standard controller with a custom extension to handle custom actions and page redirects.

Ideally, if the user saves the record, the entire record should refresh. This is accomplished with javascript pretty easily - I just have to specify in my apex code that the pageRefrence returns null to ensure the javascript gets invoked.

However, the problem is if the record isn't successfully saved, then I need an error message to display. If I let the javascript refresh the page, then it the error message is not displayed and the whole thing refreshes and wipes out any information the user may have typed (making it look like a successful save to boot). If I set the returned pageReference to CurrnentPage(), then the error will not display unless I remove the javascript function out of the apex:commandButton tag - but then I don't get the refreshes on a successful save.

How do I get my javascript and apex to play nicely? I tried using a boolean variable to tell the javascript to run, but it seems that even if I tell it not to refresh, just the javascript running removes the error message from displaying on the page. I also tried saving the error message to a public variable to see if I could let it refresh anyways, but shortly scratched that idea after realizing there was no way to reset the user's values. Here's where I left off at...

Any suggestions might bring back some of my sanity on this topic.

Here's my visualforce page:
<apex:page standardController="Account" extensions="FC_AccountExtension">

    <style type="text/css">
        .bPageBlock .detailList .labelCol {
            width: 4%;
        }
    </style>

    <apex:sectionHeader title="Task" subtitle="New Task" />
 
    <apex:form >
    <apex:pageBlock title="Task Edit" mode="Edit">
        <apex:pageBlockButtons location="top">
            <apex:commandButton action="{!saveTask}" oncomplete="doRefreshPage({!refreshConsole}); return false;" value="Save" id="save"/>
            <!--oncomplete="doRefreshPage(); return false;"  oncomplete="doRefreshPage({!refreshConsole}); return false;" -->
            <apex:commandButton action="{!cancelTask}" value="Cancel" immediate="true"/>
        </apex:pageBlockButtons>
        
        <br/><br/>
        <apex:pageMessages />
        <apex:pageMessage severity="ERROR" summary="{!errorMessage}" rendered="{!errorMessage != null}" strength="3" />        
        <apex:pageBlockSection title="Task Information" columns="2">
            <apex:pageBlockSection columns="1" showHeader="false">
                <apex:inputField value="{!task.OwnerId}" required="true"/>
                <apex:inputField value="{!task.Subject}" required="true"/>
                <apex:inputfield value="{!task.ActivityDate}"/>
                <apex:inputField value="{!task.Priority}" required="true"/>
                <apex:inputField value="{!task.Demo__c}"/>
                <apex:inputField value="{!task.Pre_Call__c}"/>
                <apex:inputField value="{!task.Call_attempted_no_message_left__c}"/>
                <apex:inputField value="{!task.Prospecting_call_connected__c}"/>
                <apex:inputField value="{!task.Prospecting_call_left_message__c}"/>
                <apex:inputField value="{!task.Prospecting_call_affirmative__c}"/>
                <apex:inputField value="{!task.Add_to_Campaign__c}"/>
                <apex:inputField value="{!task.Promotion_Campaign__c}"/>
                <apex:inputField value="{!task.Billable_Docs__c}"/>                                                                                                                                                
            </apex:pageBlockSection>
            <apex:pageBlockSection columns="1" showHeader="false">
                <apex:inputField value="{!task.Status}"/>
                <apex:inputField value="{!task.Type}"/>
                <apex:inputField value="{!task.WhoId}"/>
                <apex:inputField value="{!task.WhatId}"/>
                <apex:inputField value="{!task.Promo__c}"/>
                <apex:inputField value="{!task.No_Promo__c}"/>
                <apex:inputField value="{!task.On_site_call_connected__c}"/>
                <apex:inputField value="{!task.On_site_call_dropped_lit__c}" label="On site call, dropped it?"/>
                <apex:inputField value="{!task.Unknown_PM_System_Call__c}"/>
            </apex:pageBlockSection>            
        </apex:pageBlockSection>     
        <apex:pageBlockSection columns="1" title="Additional Comments">
            <apex:inputField value="{!task.Description}" style="width:98%;"/>
        </apex:pageBlockSection>   
    </apex:pageBlock>
    </apex:form>

    <apex:includeScript value="/support/console/31.0/integration.js"/>    
    <script type='text/javascript'>
        //This function allows the user to press enter to search
        var refreshPrimaryTab = function showTabId(result) {
            var tabId = result.id;
            sforce.console.refreshPrimaryTabById(tabId, true);
        }
        function doRefreshPage(refreshConsole) {
            if(refreshConsole == true)
                sforce.console.getEnclosingPrimaryTabId(refreshPrimaryTab);
        }
    </script>      
</apex:page>

And the part of the controller that's relevant:
public pageReference saveTask() {
        PageReference pageRef = null;
        refreshConsole = false;
        
        try {
            //upsert for updating/inserting new contact
            upsert task;
            
            //Allow the javascript to refresh the page
            refreshConsole = true;

            //clear the task for next action
            //pageRef = new PageReference('/apex/SCC_Task_Related_List?id=' + task.WhatId);
            //pageRef.setRedirect(true);
            task = null;
        }
        catch(system.DMLException e) {
            //ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, e.getDmlMessage(0)));
            errorMessage = e.getDMLMessage(0);
            pageRef = ApexPages.CurrentPage();
        }
        
        //Do not need to set a page redirect here otherwise it overrides the javascript to refresh            
        return pageRef;
    }