• oski93
  • NEWBIE
  • 15 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 7
    Replies
Hi folks, 

This seems like a weird one (must be dead simple, but not seeing it).

I'm simply trying to access an Http response header key value as specified in the docs, When I try to save, the compiler is complaining about the method signature. I've tried in a few different orgs to make sure somehow the HttpResponse class hadn't been overridden somehow...

Thanks for any clues/suggestions.
public class HttpTesting {
    public HttpTesting() {
        String aString = 'aHeaderKey';
        HttpRequest anHttpRequest = new HttpRequest();
		HttpResponse anHttpResponse = new Http().send(anHttpRequest);

        System.debug('---> anHttpResponse.getHeaderKeys(): ' + anHttpResponse.getHeaderKeys());
        System.debug('---> anHttpResponse.getHeaderKey(aString): ' + anHttpResponse.getHeaderKey(aString));  // <--- 'Method does not exist or incorrect signature: void getHeaderKey(String) from the type System.HttpResponse'
    }
}

 
  • January 14, 2018
  • Like
  • 0
Hi all,

Hoping to get some community feedback here to help benchmark whether I'm being too paranoid.

Situation: A commerical SaaS platform vendor has pitched their platform to my company. They have stated that they have "Salesforce Integration" with their platform. All I have access to at this point is a 'configuration' document from them describing how to configure our org for integrating with them - create Connected App/SSO, custom domain and even manually create a custom setting with fields they specify in their doc. So far, so good.

Then, at the end of their 'configuration' document, they list 22 classes and 6 Visualforce pages for us to manually create via copying/pasting of source files into our org, that they will presumably provide us.

Am I unreasonable to think this seems crazy in terms of:
  • owning their test coverage and and any related test failures within our org (i.e., blocking production deployments, etc.)
  • dealing with any current/future namespace conflict with their source file names
  • just generally our 'owning' these assets as if we had developed them ourselves
I've never heard of a vendor providing a Salesforce integration/installation like this before (versus providing a managed package via the AppExchange which is subsequently configured within our org).

We've already inherited a complex org in terms of coding customizations and test coverage issues, so I might be particularly sensitive to adding additional code/complexity that we would have to take the time to review ourselves and support going forward.

Even if we ultimately agree that their source is a 'reference implemention' that we will enhance/extend, shouldn't they be providing it as an unmanged package at the very least?

Thanks for any perspectives and thoughts.

-L
  • February 20, 2015
  • Like
  • 0

Hi,

We have developed and are iterating on an AppExchange app that integrates with our cloud platform.

As part of the app installation process and handshake with our platform, we are hoping that there is some way we can identify whether a given company/customer has already been provisioned within our platform, *regardless* of whether they are installing to a Salesforce sandbox, developer, or production org within the scope of their Salesforce org 'umbrella'.

I know that we can acquire the Org Id of the specific org on which the app package has been installed, but is there any way for us to detect programmatically via the post-install script (i.e., on app installation) or other code within the installed app that the same customer has installed the app to their sandbox, and then later when they install the app to their production org, we are able to identify that the installation is related to the same customer that had already installed to their sandbox?

What data is available to post-install code that can tell us whether an org rolls-up to the same customer that had installed the app on another org that they own?

Any tips and thoughts would be greatly appreciated. Thanks.

  • August 27, 2014
  • Like
  • 0

Hi all,

 

I have a requirement whereby we send a user/customer an e-mail (not sent from Salesforce) a link to a Salesforce sites URL.

 

The URL is unique to the user receiving the e-mail, and on access the controller can determine which object (a contact or lead) is associated with the URL.

 

Ideally I'd like to present the user with a page that will allow them to toggle and save some checkbox fields on the related object.

 

My understanding is that sites users are not able to edit standard object data and we don't want to (can't) force users to authenticate in order to maintain this data.

 

Would anyone have any 'best practice' suggestions on how to accomplish the above with Salesforce?

 

Thanks in advance.

  • November 07, 2012
  • Like
  • 0
Hi folks, 

This seems like a weird one (must be dead simple, but not seeing it).

I'm simply trying to access an Http response header key value as specified in the docs, When I try to save, the compiler is complaining about the method signature. I've tried in a few different orgs to make sure somehow the HttpResponse class hadn't been overridden somehow...

Thanks for any clues/suggestions.
public class HttpTesting {
    public HttpTesting() {
        String aString = 'aHeaderKey';
        HttpRequest anHttpRequest = new HttpRequest();
		HttpResponse anHttpResponse = new Http().send(anHttpRequest);

        System.debug('---> anHttpResponse.getHeaderKeys(): ' + anHttpResponse.getHeaderKeys());
        System.debug('---> anHttpResponse.getHeaderKey(aString): ' + anHttpResponse.getHeaderKey(aString));  // <--- 'Method does not exist or incorrect signature: void getHeaderKey(String) from the type System.HttpResponse'
    }
}

 
  • January 14, 2018
  • Like
  • 0
I realize this is a relativly new thing but I am new to the salesforce platform in general and not sure if my questions are lightning component specific, or more a general salesforce question, so here goes.
I am working through the workbook: http://www.salesforce.com/us/developer/docs/lightning/lightning.pdf and ran into a couple things I just can't make sense of.

1. Prefix's.
    a. I know in visualforce the "c:" prefix means you're using a component. I posted the code below as a reference. In the formhelper.js line "  var action = component.get("c.getExpenses");" what is the "c." referencing?
   b. in the line "action.setCallback(this, function(a){" what is the "a"? is it related to the "A" in "$A.enqueueAction(action);"?
   c. What is the "v" prefix referencing in "var expenses = component.get( "v.expenses");"?

My best guess is that "v"  is for accessing a variable, and "c" for a component, while the "a" passed into the function is a generic placeholder for something (but Idk what...). I don't see anywhere in the code where these 3 prefixes are initialed or declared, which is throwing me off. I'm a Java guy and learning javascript as well as salesforce, so i'm sure it's something obvious that I just don't know yet. I just want to thouroughly understand the example and this piece is giving me grief.


FormHelper.js:
({
    getExpenses : function(component) {
        var action = component.get("c.getExpenses");
        var self = this;
        action.setCallback(this, function(a){
            component.set("v.expenses", a.getReturnValue());
            self.updateTotal(component);
        });
        $A.enqueueAction(action);
    },
    updateTotal : function(component){
        var expenses = component.get( "v.expenses");
        var total = 0;
        for(var i=0; i<expenses.length; i++){
            var e = expenses[i];
            total += e.zoidberg__Amount__c;
        }
        //Update counters
        component.set("v.total",total);
        component.set("v.exp" ,expenses.length);
    },
    createExpense : function(component, expense){
        
        this.upsertExpense(component, expense, function(a) {
            
            var expenses = component.get("v.expenses");
            expenses.push(a.getReturnValue());
            component.set("v.expenses",expenses);
            this.updateTotal(component);
            
        });
    },
    upsertExpense : function(component, expense, callback){
        var action = component.get("c.saveExpense");
        action.setParams({
            "expense":expense
        });
        if(callback){
            action.setCallback(this,callback);
        }
        $A.enqueueAction(action);
    }
})

formController.js:
({
    doInit : function(component, event, helper) {
        helper.getExpenses(component);
    },
    createExpense : function (component,event,helper){
        var amtField = component.find("amount");
        var amt = amtField.get("v.value");
        if(isNaN(amt)||amt==''){
            amtField.setValid("v.value",false);
            amtField.addErrors("v.value",[{message:"Enter an expense amount."}]);
        }
        else{
            amtField.setValid("v.value",true);
            var newExpense = component.get("v.newExpense");
            helper.createExpense(component,newExpense);
        }
    },
    updateEvent : function(component, event, helper){
        helper.upsertExpense(component,event.getParam("expense"));
    },
    waiting : function(component, event, helper){
        component.set("v.wait","updating...");
    },
     doneWaiting : function(component, event, helper){
        component.set("v.wait","");
    },
})

form.cmp:
<aura:component controller="zoidberg.ExpenseController">
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    <aura:handler event="zoidberg:updateExpenseItem" action="{!c.updateEvent}"/>
    <aura:handler event="aura:waiting" action="{!c.waiting}"/>
    <aura:handler event="aura:doneWaiting" action="{!c.doneWaiting}"/>
    <aura:attribute name="wait" type="String"/>
    <aura:attribute name="expenses" type="zoidberg.Expense__c[]"/>
    <aura:attribute name="newExpense"
                    type="zoidberg.Expense__c"
                    default="{ 'sobjectType': 'zoidberg__Expense__c',
                                 'Name': '',
                                 'zoidberg__Amount__c': 0,
                                 'zoidberg__Client__c': '',
                                 'zoidberg__Date__c': '',
                                 'zoidberg__Reimbursed__c': false
                             }"/>
    
    <!-- Attributes for Expense Counters -->
    <aura:attribute name= "total" type="Double" default="0.00"/>
    <aura:attribute name="exp" type="Double" default="0" />
    <div class="wait">
        {!v.wait}
    </div>
    <!-- Input from using components -->
    <form>
        <fieldset>
            <ui:inputText aura:id="expname" label="Expense Name"
                          class="form-control"
                          value="{!v.newExpense.name}"
                          placeholder="My Expense" required="true"/>
            <ui:inputNumber aura:id="amount" label="Amount"
                          class="form-control"
                          value="{!v.newExpense.zoidberg__Amount__c}"
                          placeholder="20.80" required="true"/>
            <ui:inputText aura:id="client" label="Client"
                          class="form-control"
                          value="{!v.newExpense.zoidberg__Client__c}"
                          placeholder="ABC Co."/>
            <ui:inputDateTime aura:id="expdate" label="Expense Date"
                          class="form-control"
                          value="{!v.newExpense.zoidberg__Date__c}"
                          displayDatePicker="true"/>
            <ui:inputCheckbox aura:id="reimbursed" label="Reimbursed?"
                          class="form-control"
                          value="{!v.newExpense.zoidberg__Reimbursed__c}"/>
            <ui:button label="Submit" press="{!c.createExpense}"/>
        </fieldset>
    </form>
    
    <!--Expense Counters -->
    <div class="row">
        <!--Change the counter color to red if total amount is more than 100 -->
        <div class= "{!v.total >= 100 ? 'alert alert-danger' : 'alert alert-success'}">
            <h3>Total Expenses</h3>$
            <ui:outputNumber value="{!v.total}" format=".00" />
        </div>
        <div class="alert alert-success">
            <h3>No. of Expenses </h3>
            <ui:outputNumber value="{!v.exp}"/>
        </div>
    </div>
    <!--Display expense records -->
    <div class="row">
        <aura:iteration items="{!v.expenses}" var="expense">
           <zoidberg:expenseList expense="{!expense}"/>
        </aura:iteration>
    </div>
</aura:component>

Hi,

We have developed and are iterating on an AppExchange app that integrates with our cloud platform.

As part of the app installation process and handshake with our platform, we are hoping that there is some way we can identify whether a given company/customer has already been provisioned within our platform, *regardless* of whether they are installing to a Salesforce sandbox, developer, or production org within the scope of their Salesforce org 'umbrella'.

I know that we can acquire the Org Id of the specific org on which the app package has been installed, but is there any way for us to detect programmatically via the post-install script (i.e., on app installation) or other code within the installed app that the same customer has installed the app to their sandbox, and then later when they install the app to their production org, we are able to identify that the installation is related to the same customer that had already installed to their sandbox?

What data is available to post-install code that can tell us whether an org rolls-up to the same customer that had installed the app on another org that they own?

Any tips and thoughts would be greatly appreciated. Thanks.

  • August 27, 2014
  • Like
  • 0
I'm doing a proof of concept for some dashboards we are going to be displaying on monitors around the office. I'm trying to get the Highcharts example into a visualforce page to show what it is capable of but the page won't display anything and I don't know why. It's such a simple page but I'm not a javascript developer and I'm pulling my hair out.

<apex:page sidebar="false" showHeader="false"  >
<apex:includeScript value="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js" />
<apex:includeScript value="http://code.highcharts.com/highcharts.js" />
<apex:includeScript value="http://code.highcharts.com/modules/exporting.js" />
    
    <script type="text/javascript">
    $(function () {
    $('#container').highcharts({
        chart: {
            type: 'bar'
        },
        title: {
            text: 'Fruit Consumption'
        },
        xAxis: {
            categories: ['Apples', 'Bananas', 'Oranges']
        },
        yAxis: {
            title: {
                text: 'Fruit eaten'
            }
        },
        series: [{
            name: 'Jane',
            data: [1, 0, 4]
        }, {
            name: 'John',
            data: [5, 7, 3]
        }]
    });
});
</script>

  <div id="container"  style="height: 400px;" > </div>
 
</apex:page>
  • March 12, 2014
  • Like
  • 0

Hi Folks,

 

I have assigned 4 custom boolean fields to the Contacts and these are for users to update which email they would like to subscribe too, such as Monthly Newsletter, New Courses etc.

 

I am trying to create a page on our force.com site that displays the 4 checkboxes with a save button, so we can attach a link to the bottom of the emails we send for users to update their subscriptions to the emails we send them.

 

Visualforce Page:

 

<apex:page Controller="EmailSubscriptionController">
    <apex:form >
        <apex:messages />
        <br />

        <apex:inputCheckbox id="Brochure_email__c" value="{!contact.Brochure_email__c}"/>Brochure Email<br />
        <apex:commandButton value="Save" action="{!save}"/>


    </apex:form>
</apex:page>

 

Apex Class:

 

public class EmailSubscriptionController {

    public final Contact contact;
    public ID get_id {get;set;}
    public boolean email_brochure {get;set;}

    public EmailSubscriptionController() {
        contact = [SELECT Brochure_email__c  FROM Contact
            WHERE Id = :ApexPages.currentPage().getParameters().get('id')];
    }

    public Contact getContact() {
        return contact;
    }

    public PageReference save() {

        try {
            upsert(contact);
        } catch(System.DMLException e) {
            ApexPages.addMessages(e);
            return null;
        }

        return null;

    }
}

 

The code shows me the force.com page fine, and check's the relevant boxes, but when i click update it gives me the following error message:

 

system.security.NoAccessException: Update access denied for Contact

 

Any ideas on how i can get this working?

 

Many Thanks

 

Dave

 

 

I have the following SOQL used in a VisualForce page:

 

"Select c.Product__r.PA_Product_Class__c productClass, sum(c.Rolling_12_Current__c) sales from PA_Customer_History__c c where c.Account__c = '{!account.Id}' group by c.Product__r.PA_Product_Class__c"

 

The field Rolling_12_Current__c is a currency field and the records I am querying are all in USD. Our corporate currency is EUR. My user is set up with a currency of USD. When the query is run, the sum() returns back a converted value in EUR instead of USD. According to the documentation at http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_soql_querying_currency_fields.htm, this shouldn't happen: "Currency data is converted to the user's locale and then processed by the aggregate function."

 

My user's currency is in USD, so it should display it properly in USD. As a temporary work around, I've changed our exchange rate to 1. Can someone please let me know how I can get the SOQL aggregate to return the values in my user's currency? I tried using convertCurrency, but I get a malformed query error.