- CloudGeek
- NEWBIE
- 470 Points
- Member since 2014
- SFDC Consultant
-
ChatterFeed
-
8Best Answers
-
1Likes Received
-
2Likes Given
-
21Questions
-
85Replies
bind recordtype to picklist
My requirement is to bind recordtypes to an picklist and display in visual force page
I have the code show in this post.
public with sharing class recordtypepicklist { public list<SelectOption> getRecordTypes() { list<SelectOption> options = new list<SelectOption>(); for(RecordType sRecordType:[select ID,Name from RecordType where SObjectType='Contact']) { options.add(new SelectOption(sRecordType.ID,sRecordType.Name)); } return options; } }I am getting an error as Error: Compile Error: Variable does not exist: ID at line 9 column 38
Its coming from the statement inside the for loop.
Pls let me know how to resolve this.
pooja
- pooja biswas
- May 11, 2016
- Like
- 0
- Continue reading or reply
get custom fields
I am understading the basics of metadata of fetching account info.
below is the code
public class selectAllSOQLExampleController { String SobjectApiName = 'Account'; List<Account> accList=new List<Account>(); public String query{get;set;} public List<Account> getAccList() { Map<String,Schema.SObjectType> schemaMap=Schema.getGlobalDescribe(); Map<String, Schema.SObjectField> fieldMap = schemaMap.get(SobjectApiName).getDescribe().fields.getMap(); String commaSeparatedFields = ''; for(String fieldName : fieldMap.keyset()) { if(commaSeparatedFields == null || commaSeparatedFields == '') { commaSeparatedFields = fieldName; } else { commaSeparatedFields = commaSeparatedFields + ', ' + fieldName; } } query = 'select ' + commaSeparatedFields + ' from ' + SobjectApiName + ' Limit 10 '; accList = Database.query(query); return accList; } } <apex:page controller="selectAllSOQLExampleController"> <apex:form> <apex:pageBlock> <apex:pageBlockSection title="Account table" columns="1" collapsible="false"> <apex:pageBlockTable value="{!accList}" var="acc"> <apex:column value="{!acc.name}"/> <apex:column value="{!acc.phone}"/> <apex:column value="{!acc.rating}"/> <apex:column value="{!acc.industry}"/> <apex:column value="{!acc.accountnumber}"/> </apex:pageBlockTable> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>My requirement is I want to display custom fields also.
Pls help me in tweeking my code.
pooja
- pooja biswas
- May 10, 2016
- Like
- 0
- Continue reading or reply
Regex Formula Validation to Require [A-Z][a-z] - and space
I would love to get some quick help with this validation rule:
NOT(
OR(
ISBLANK(Last_Name__c),REGEX(Last_Name__c ,"([a-zA-Z-])*")))
What I want is for Last Name to include only a-z, A-Z, hyphens or spaces.
When I first wrote it as this: REGEX(Last_Name__c ,"([a-zA-Z])*"))) -- without the hyphen, I was getting it to work to allow spaces. However, once I added the hyphen in, the hyphen was allowed but spaces were no longer allowed.
What am I doing wrong here?
Thanks!
Stephanie
- Stephanie Zimmerman 9
- May 09, 2016
- Like
- 0
- Continue reading or reply
Standard Way to override view button
I want to override view button(Standard detail page) for certain profiles but not for all. What is the standard way to override? I am thinking to use nooverride=1 but not sure if it is a URL hack or standard way. Any help would be appreciated.
Thanks,
- sachin kadian 5
- May 08, 2016
- Like
- 0
- Continue reading or reply
Converting GMT into Locale Users Time Zone
- PlatFormCloud
- May 06, 2016
- Like
- 0
- Continue reading or reply
Need Help With Formula Field
Here is the error message I receive:
Error: Incorrect number of parameters for function 'IF()'. Expected 3, received 4
Here is the code:
IF(YEAR(TODAY()) = YEAR(Product_Close_Date__c),
AND(IF( Product_Probability__c, "10%",
(TotalPrice / 12) * 0.10 * (13 - (MONTH(Product_Close_Date__c))),
AND(IF( Product_Probability__c, "15%",
(TotalPrice / 12) * 0.15 * (13 - (MONTH(Product_Close_Date__c))),
AND(IF( Product_Probability__c, "20%",
(TotalPrice / 12) * 0.20 * (13 - (MONTH(Product_Close_Date__c))),
AND(IF( Product_Probability__c, "40%",
(TotalPrice / 12) * 0.40 * (13 - (MONTH(Product_Close_Date__c))),
AND(IF( Product_Probability__c, "75%",
(TotalPrice / 12) * 0.75 * (13 - (MONTH(Product_Close_Date__c))),
AND(IF( Product_Probability__c, "100%",
(TotalPrice / 12) * 0.100 * (13 - (MONTH(Product_Close_Date__c))),
0)))))))))))))
- Denise Meinershagen
- May 06, 2016
- Like
- 0
- Continue reading or reply
Max Date Display on Standard Object
I have 2 objects:
Object 1: Standard Object [Contact]
Object 2: Custom Object [Apple]
Relationship: Look up relationship.
Apple records can be found under contact related list.
Is it possible to display the latest created date from the related list on the conact custom field "latest date"
- Z man0
- May 05, 2016
- Like
- 0
- Continue reading or reply
Duplicate Detection
IF(RecordTypeName=='BCIS - Consumer' || RecordTypeName =='Consumer'|| RecordTypeName == 'Wealth'){
BCISDupProspectList = [SELECT Id, Name, OwnerID,Primary_Phone__c,Secondary_Phone__c,email__c,Owner.Name,Owner.Email FROM Prospect__c WHERE first_name__c = :Prospect.First_Name__c AND
Last_Name__c = :Prospect.Last_Name__c and RecordType.Name <> 'BCIS - Consumer Prospect'
AND ((Email__c = :Prospect.Email__c and Email__c <> null) OR
(Primary_Phone__c = :Prospect.Primary_Phone__c and Primary_Phone__c <> null) OR
(Secondary_Phone__c = :Prospect.Secondary_Phone__c and Secondary_Phone__c <> null))];
- Ben Kingsley 8
- May 04, 2016
- Like
- 0
- Continue reading or reply
Does the TimeZone matters while converting Lead in SF ?
I have a situation where I got to convert leads as different timezone users (from various locations).
While converting a lead , have encountered an issue "Invalid date: 05/20/2016".
This exception error occured for an Australian User with Sydney Time Zone in SF set to his User record.
Would like to know if the timezone matters in this or not ?
I already have gone through the link : https://help.salesforce.com/apex/HTViewHelpDoc?id=opp_fields.htm&language=en
Where the Close Date field section says this
Close Date :- Date when you plan to close the opportunity. You can enter a date, or choose a date from the calendar that displays when you put your cursor in the field. Opportunities with a Close Date in a given month will tally in the forecast for that month, unless you assign them to the Omitted category while editing the forecast. When you set an open opportunity's Stage to a type of “Closed/Won,” the Close Date is set to the current date in Coordinated Universal Time (UTC). At certain times of day, UTC will differ by one day from your time zone.
What is the good way to handle this or get rid of this , if timezone is one of the factors causing this ?
- CloudGeek
- May 18, 2016
- Like
- 0
- Continue reading or reply
need input for a pop-up onclick button from Account Detail screen
I need input on how to start with for the pop-up screen attached here.
I need to show a pop-up on a button click from an account detail page as shown in snapshot
instead of showing any other page as pop-up, would like to create this purely in javascript/jQuery.
Thanks in advance!
- CloudGeek
- April 12, 2016
- Like
- 0
- Continue reading or reply
How to add custom button to AccountDetail overwritten page or layout ?
For account detail screen, it's been identified that it is overwritten bya VF page,
apex/AccountDetailOverride?id=001190000087LKcAAM -----This is the URL I found on account view record
But I go see the VF page code I do nto see any Edit button code or something , Still I see Edit button on record View
VF Page Code is :
<apex:page standardController="Account" extensions="AMindSwitchContextControllerExt" sidebar="true" showHeader="true" id="acctDetail"> <apex:includeScript value="{!$Resource.cometd}"/> <apex:includeScript value="{!$Resource.jquery_cometd}"/> <apex:includeScript value="{!URLFOR($Resource.treeviewGrid2983, 'jquery.min.js')}" /> <apex:includeScript value="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"/> <script> var j$ = jQuery.noConflict(); j$("iframe").each(function(){ j$(this).load(function() { j$(this).height(j$(this).contents().find("body").height() ); }); }); function setFocusOnLoad() {} console.log("About to init cometd"); var sFjQuery$ = jQuery.noConflict(); // Connect to the CometD endpoint sFjQuery$.cometd.init({ url: window.location.protocol+'//'+window.location.hostname+'/cometd/24.0/', requestHeaders: { Authorization: 'OAuth {!$Api.Session_ID}'} }); // Subscribe to the push topic sFjQuery$.cometd.subscribe('/topic/DiscountApprovalUpdates', function(updates) { console.log(updates); quote = updates.data.sobject; action = quote.Discount_Approval_Status__c; quoteId = quote.Siebel_ROW_ID__c; var message = '{"action":"' + action + '","quoteId":"' + quoteId + '"}'; var receiver = window.open("", "Quote Preview"); receiver.postMessage(message, "*"); console.log(message); }); </script> <chatter:feedwithFollowers entityId="{!Account.Id}"/> <!--<c:HoverHeader />--> <c:HoverHeader /> <apex:detail relatedList="false" inlineEdit="true" showChatter="false" relatedListHover="false"/> <apex:include pageName="accountRelationViewer"/> <apex:relatedList list="Renewals__r" rendered="{!$ObjectType.Renewals__c.accessible}" id="Renewals"/> <apex:relatedList list="Contacts" id="Contacts" rendered="{!$ObjectType.Contact.accessible}"/> <apex:relatedList list="Addresses__r" rendered="{!$ObjectType.Address__c.accessible}" id="Addresses"/> <apex:pageBlock rendered="{!($ObjectType.Asset.accessible)}"> <apex:outputlabel style="display:block; font-size: 1.2em; font-family: Arial,Helvetica,sans-serif; font-weight: bold;"> Products and Services </apex:outputlabel> <apex:outputPanel > <div style="display: inline-block;"> <c:AssetRelatedList accountid="{!account.Id}" accountname="{!account.Name}"/> </div> </apex:outputPanel> </apex:pageBlock> <apex:pageBlock rendered="{!($ObjectType.Asset.accessible)}"> <apex:outputlabel style="display:block; font-size: 1.2em; font-family: Arial,Helvetica,sans-serif; font-weight: bold;"> Online Subscriptions </apex:outputlabel> <apex:outputPanel > <div style="display: inline-block;"> <c:OnlineSubscriptionRelatedlist accountid="{!account.Id}" accountname="{!account.Name}"/> </div> </apex:outputPanel> </apex:pageBlock> <apex:outputPanel rendered="{!($ObjectType.Asset.accessible)}" > <div > <c:QuoteRelatedList /> </div> </apex:outputPanel> <!-- SFDC-964, SFDC-841: create session with invisible canvasApp prior to JSON call --> <apex:canvasApp applicationName="Application_v1" parameters="{canvasSource:'Start',sfdcInConsoleUI:'{!aMindSwitchContextInConsole}',discountThreshold:'{!$User.Discount_Threshold__c}'}" width="0" height="0" maxHeight="0" maxWidth="0" /> <apex:relatedList list="Activation_Codes__r" rendered="{!$ObjectType.ActivationCodes__c.accessible}" id="ActivationCode"/> <apex:relatedList list="AccountTeamMembers" rendered="{!$ObjectType.AccountTeamMember.accessible}" id="AccountTeamMembers"/> <apex:relatedList list="Career__r" rendered="{!$ObjectType.Training__c.accessible}" id="Careers"/> <apex:relatedList list="Opportunities" rendered="{!$ObjectType.Opportunity.accessible}" id="Opportunities"/> <apex:relatedList list="Cases" rendered="{!$ObjectType.Case.accessible}" id="Cases"/> <apex:relatedList list="OpenActivities" rendered="{!$ObjectType.Task.accessible}" id="OpenActivities"/> <apex:relatedList list="CombinedAttachments" rendered="{!$ObjectType.NoteandAttachment.accessible}" id="NotesAndAttachment"/> <apex:relatedList list="ActivityHistories" rendered="{!$ObjectType.Task.accessible}" id="ActivityHistories"/> <!--apex:relatedList list="Account_Relationships1__r" rendered="{!($ObjectType.Account_Relationship__c.accessible && $Profile.Name == 'Master Admin')}" id="AccountRelationships" pageSize="5" --> <apex:relatedList list="Account_Owner_History__r" rendered="{!($ObjectType.Account_Owner_History__c.accessible)}" id="AccountOwnerHistory"/> <apex:relatedList list="Accounts_Management__r" rendered="{!($ObjectType.Account_Management__c.accessible)}" id="AccountManagement"/> <apex:pageBlock title="Account History" rendered="{!$ObjectType.AccountHistory.accessible}"> <apex:pageBlockTable value="{!account.histories}" var="accounthistory" id="HistTable" rowClasses="odd,even" width="100%"> <apex:facet name="footer"></apex:facet> <apex:column > <apex:facet name="header">Edit Date</apex:facet> <apex:facet name="footer"></apex:facet> <apex:outputText value="{0,date,MM/dd/yyyy HH:mm }"> <apex:param value="{!accounthistory.createddate}" /> </apex:outputText> </apex:column> <apex:column > <apex:facet name="header">Field</apex:facet> <apex:facet name="footer"></apex:facet> <b><apex:outputText value="{!accounthistory.field}"/></b> </apex:column> <apex:column > <apex:facet name="header">Edited By</apex:facet> <apex:facet name="footer"></apex:facet> <apex:outputText value="{!accounthistory.createdby.name}"/> </apex:column> <apex:column > <apex:facet name="header">Old Value</apex:facet> <apex:facet name="footer"></apex:facet> <apex:outputText value="{!accounthistory.oldvalue}"/> </apex:column> <apex:column > <apex:facet name="header">New Value</apex:facet> <apex:facet name="footer"></apex:facet> <apex:outputText value="{!accounthistory.newvalue}"/> </apex:column> </apex:pageBlockTable> </apex:pageBlock> <apex:relatedList list="VOC_Survey_Response__r" rendered="{!$ObjectType.VOC_Survey_Response__c.accessible}" id="SurveyResponses"/> <apex:relatedList list="Billing_Profiles__r" rendered="{!$ObjectType.Billing_Profile__c.accessible}" id="BillingProfile"/> <!-- DMD 3/30/2016 : BTBS-3911 Adobe eSignature for DPP contracts --> <apex:relatedList list="echosign_dev1__Agreements__r" rendered="{!$ObjectType.echosign_dev1__SIGN_Agreement__c.accessible}" id="Agreement" /> <!-- The below is to register the links at the top on a related list to related list basis. pageId: the page id set in the apex:page tag relatedListId: the id set in the apex:relatedList tag permission: boolean variable for access to the object. true can be passed if guaranteed access (not recommended) --> <c:HoverFooter pageId="acctDetail" relatedListId="Contacts" permission="{!$ObjectType.Contact.accessible}"/> <c:HoverFooter pageId="acctDetail" relatedListId="Addresses" permission="{!$ObjectType.Address__c.accessible}"/> <c:HoverFooter pageId="acctDetail" relatedListId="AccountTeamMembers" permission="{!$ObjectType.AccountTeamMember.accessible}"/> <c:HoverFooter pageId="acctDetail" relatedListId="Careers" permission="{!$ObjectType.Training__c.accessible}"/> <c:HoverFooter pageId="acctDetail" relatedListId="Opportunities" permission="{!$ObjectType.Opportunity.accessible}"/> <c:HoverFooter pageId="acctDetail" relatedListId="Cases" permission="{!$ObjectType.Case.accessible}"/> <c:HoverFooter pageId="acctDetail" relatedListId="OpenActivities" permission="{!$ObjectType.Task.accessible}"/> <c:HoverFooter pageId="acctDetail" relatedListId="NotesAndAttachment" permission="{!$ObjectType.NoteAndAttachment.accessible}"/> <c:HoverFooter pageId="acctDetail" relatedListId="ActivityHistories" permission="{!$ObjectType.Task.accessible}"/> <c:HoverFooter pageId="acctDetail" relatedListId="SurveyResponses" permission="{!$ObjectType.VOC_Survey_Response__c.accessible}"/> <c:HoverFooter pageId="acctDetail" relatedListId="AccountManagement" permission="{!$ObjectType.Account_Management__c.accessible}"/> <c:HoverFooter pageId="acctDetail" relatedListId="BillingProfile" permission="{!$ObjectType.Billing_Profile__c.accessible}"/> <c:HoverFooter pageId="acctDetail" relatedListId="Agreement" permission="{!$ObjectType.echosign_dev1__SIGN_Agreement__c.accessible}" /> </apex:page>
- CloudGeek
- April 11, 2016
- Like
- 0
- Continue reading or reply
What's the learning curve for DEV-501 SFDC Certification ?
Could be some basic question , but want to know what exactly is the learning curve/path for DEV-501 certification ?
What are the most critical/important things that are tested in this exam ?
- CloudGeek
- April 11, 2016
- Like
- 0
- Continue reading or reply
Nee help for lead conversion code from JavaScript
I would like to implement lead convert functionality from javascript, which will be invoked by a button click on a VF Page.
How do we implement this in javaScript to convert lead and get all the lead converted details (AccountId,ContactId,OpptyID) ?
- CloudGeek
- April 06, 2016
- Like
- 0
- Continue reading or reply
Apex REST Callouts - Challenge Not Yet Complete : Make Sure the method Exists with the Name
Executing the 'getAnimalNameById' method on 'AnimalLocator' failed. Make sure the method exists with the name 'getAnimalNameById', is public and static, accepts an Integer and returns a String.
My Class Code is here :
global class AnimalLocator { public static String getAnimalNameById(Integer num) { Http http = new Http(); HttpRequest request = new HttpRequest(); request.setEndpoint('https://th-apex-http-callout.herokuapp.com/animals/:'+num); request.setMethod('GET'); HttpResponse response = http.send(request); String answer='VenMal'; // If the request is successful, parse the JSON response. if (response.getStatusCode() == 200) { System.debug('response.getBody() ========'+response.getBody()); answer = 'NEW ANIMAL'; } return answer; } }
And the TEST Class is as below:
@isTest global class AnimalLocatorTest { static testMethod void testCallOut() { // Set mock callout class Test.setMock(HttpCalloutMock.class, new AnimalLocatorMock()); // This causes a fake response to be sent // from the class that implements HttpCalloutMock. string response = AnimalLocator.getAnimalNameById(1); // Verify that the response received contains fake values System.debug('response === '+response); } }
Test Mock Class is as below:
@isTest global class AnimalLocatorMock implements HttpCalloutMock { // Implement this interface method global HTTPResponse respond(HTTPRequest request) { // Create a fake response HttpResponse response = new HttpResponse(); response.setHeader('Content-Type', 'application/json'); response.setBody('{"animal":{"id":0,"name":"VenMal","eats":"MeaTT","says":"ThanKYoU"}}'); response.setStatusCode(200); return response; } }
When I queried the ApexClass Object, I could see all 3-classes
Am I missing something or what should I do to succesfully validate this Unit ?
- CloudGeek
- April 06, 2016
- Like
- 0
- Continue reading or reply
Apex REST Test Class Issue (When run in Anonymous window results look good)
I have the below test class for my REST Class:
When I run this test class always the returned list is empty though actually I am able to see data on page.
And when I run this test class code from anynymous window - I get to see results are fine with no of rows as expected.
Can anyone help me understand If I am missing something here ?
@isTest public class OSCTestClass { static testMethod void getMeListOfProducts() { // Set up a test request RestRequest request = new RestRequest(); // Set request properties String sfdcBaseURL = URL.getSalesforceBaseUrl().toExternalForm(); System.debug('sfdcBaseURL = '+sfdcBaseURL); request.requestUri = sfdcBaseURL+'/services/apexrest/onlinesalesUIcatalogueNew/'; request.httpMethod = 'GET'; request.params.put('region', 'USA'); request.params.put('segment', 'Costco'); request.params.put('product', 'ALL'); RestContext.request = request; List<OnlineSalesCatalogWrapper> results = new List<OnlineSalesCatalogWrapper>(); results = OnlineSalesCatalogController.getOfferedProductsList(); System.debug('size of results = '+results.size()); } }
- CloudGeek
- April 05, 2016
- Like
- 0
- Continue reading or reply
Test Class Problem (In Anonymous Window I get returned values but in test class always empty)
I have the below test class for my REST Class:
When I run this test class always the returned list is empty though actually I am able to see data on page.
And when I run this test class code from anynymous window - I get to see results are fine with no of rows as expected.
Can anyone help me understand If I am missing something here ?
@isTest public class OSCTestClass { static testMethod void getMeListOfProducts() { // Set up a test request RestRequest request = new RestRequest(); // Set request properties String sfdcBaseURL = URL.getSalesforceBaseUrl().toExternalForm(); System.debug('sfdcBaseURL = '+sfdcBaseURL); request.requestUri = sfdcBaseURL+'/services/apexrest/OSCList/'; request.httpMethod = 'GET'; request.params.put('region', 'USA'); request.params.put('segment', 'ALL'); request.params.put('product', 'ALL'); RestContext.request = request; List<OnlineSalesCatalogWrapper> results = new List<OnlineSalesCatalogWrapper>(); String currentRequestURL = URL.getCurrentRequestUrl().toExternalForm(); System.debug('currentRequestURL = '+currentRequestURL); results = OnlineSalesCatalogController.getOfferedProductsList(); System.debug('size of results = '+results.size()); } }
- CloudGeek
- April 05, 2016
- Like
- 0
- Continue reading or reply
What's the Learning Path for SFDC Integration ?
Please suggest the approach / how to start with SFDC Integration learning.
- CloudGeek
- April 02, 2016
- Like
- 0
- Continue reading or reply
How to Start off with SFDC Integration Learning (Learning Path)
What is learning path for SFDC Integration ?
Any suggestions/links to go through ?
- CloudGeek
- April 02, 2016
- Like
- 0
- Continue reading or reply
Need input for TestClass for @HttpGet method / REST Method
I have a REST Class like below, How should we write TestClass for this @HttpGet Method ?
@RestResource(urlMapping='/myURL/*') global with sharing class myController { @HttpGet global static List<Wrapper> getMeListOfProducts() { RestRequest req = RestContext.request; string region = req.params.get('region'); string segment= req.params.get('segment'); string offertype = req.params.get('offertype'); ///Some code return listOfProducts; } }
- CloudGeek
- March 31, 2016
- Like
- 0
- Continue reading or reply
Wrapper returning array of arrays: how to convert it into a single dimensional JSON Object
I have a wrapper returning an array of arrays (list):
The code for apex method is as follows:
public static List<OnlineSalesCatalogWrapperUI> getOnlineSalesCatalogWrapperUIForRegion( String region ) { System.debug( 'getOnlineSalesCatalogWrapperUIForRegion(' + region + ')...' ); Map<String,OnlineSalesCatalogWrapperUI> wrapperUIMap = new Map<String,OnlineSalesCatalogWrapperUI>(); List<OnlineSalesCatalogWrapper> catalogItems = getOnlineSalesCatalogListForRegion( region ); List<OnlineSalesCatalogWrapperUI> catalogWrapperUIs = new List<OnlineSalesCatalogWrapperUI>(); OnlineSalesCatalogWrapperUI catalogWrapperUI = null; for ( OnlineSalesCatalogWrapper catalogItem : catalogItems ) { // Enable each item for initial load catalogItem.visible = true; // Each onlineSalesCatalogWrapper object has a different title based on the segment and // OfferTypeDescription. String catalogUIKey = catalogItem.segment + ':' + catalogItem.offerType; if ( wrapperUIMap.containsKey(catalogUIKey)) { // fetch the existing wrapper UI object to store this catalog wrapper catalogWrapperUI = wrapperUIMap.get( catalogUIKey ); catalogWrapperUI.add( catalogItem ); } else { // create a new wrapper UI object catalogWrapperUI = new OnlineSalesCatalogWrapperUI( catalogItem ); wrapperUIMap.put( catalogUIKey, catalogWrapperUI ); catalogWrapperUIs.add( catalogWrapperUI ); } /** OBSOLETE BLOCK if ( catalogWrapperUI == null ) { // first time through the loop -- create a new CatalogWrapperUI object catalogWrapperUI = new OnlineSalesCatalogWrapperUI( catalogItem ); catalogWrapperUIs.add( catalogWrapperUI ); } else if ( catalogWrapperUI.matches( catalogItem )) { // add to the wrapper UI under that segment/offerTypeDescription... catalogWrapperUI.add( catalogItem ); } else { // Did not match. Create a new segment/offerType for this UI. catalogWrapperUI = new OnlineSalesCatalogWrapperUI( catalogItem ); catalogWrapperUIs.add( catalogWrapperUI ); } ***/ } return catalogWrapperUIs; }
and the received response when we called this method as REST service is shown sample below:
[{"wrappers": [{"wrapperId":"offera2y19000000LYsRAAW_01ui000000MSJPHAA5_01u1900000BNsEVAA1","visible":true,"trialUnit":"Day","trialDuration":30,"trialDescription":"30 days","shortQBOProductName":"Essentials","shortPayrollProductName":"Full Service Payroll","segment":"New to QBO","region":"USA","qboProductPriceBookId":null,"qboProductPriceBookEntryId":"01ui000000MSJPHAA5","productCreateStr":"01ui000000MSJPHAA5|01u1900000BNsEVAA1|null|nullAmount|null|null","productCode":"QBP-T3P","payrollProductPriceBookId":null,"payrollProductPriceBookEntryId":"01u1900000BNsEVAA1","payrollListPrice":99.00,"payrollDiscountUnit":"MONTH","payrollDiscountType":"PERCENT","payrollDiscountedPrice":null,"payrollDiscountDuration":12,"payrollDiscountDescription":"20% discount for 1 year","payrollDiscountAmount":20.00,"payrollAnnualListPrice":null,"payrollAnnualDiscountedPrice":null,"offerTypeDescription":"Trial","offerType":"TRIAL","offerId":"a2y19000000LYsRAAW","offeredQBOProductId":null,"offeredQBOProduct":"QuickBooks Online Essentials","offeredPayrollProductId":null,"offeredPayrollProduct":"QuickBooks Online Payroll Full Service","listPrice":26.95,"listCurrencyCode":null,"isTrial":true,"hasDiscountAsString":"false","hasDiscount":false,"displayProductName":"QuickBooks Online Essentials w/Full Service Payroll","discountUnit":null,"discountType":null,"discountedPrice":null,"discountDuration":null,"discountDescription":null,"discountAmount":null,"currencyCode":"USD","bundleListPrice":125.95,"bundleDiscountedPrice":null,"bundleDiscountAmount":null,"annualListPrice":289.95,"annualDiscountedPrice":null},{"wrapperId":"offera2y19000000LYsRAAW_01ui000000MSJPHAA5_01u1900000BNsEUAA1","visible":true,"trialUnit":"Day","trialDuration":30,"trialDescription":"30 days","shortQBOProductName":"Essentials","shortPayrollProductName":"Enhanced Payroll","segment":"New to QBO","region":"USA","qboProductPriceBookId":null,"qboProductPriceBookEntryId":"01ui000000MSJPHAA5","productCreateStr":"01ui000000MSJPHAA5|01u1900000BNsEUAA1|null|nullAmount|null|null","productCode":"QBP-T3P","payrollProductPriceBookId":null,"payrollProductPriceBookEntryId":"01u1900000BNsEUAA1","payrollListPrice":39.00,"payrollDiscountUnit":"MONTH","payrollDiscountType":"PERCENT","payrollDiscountedPrice":null,"payrollDiscountDuration":12,"payrollDiscountDescription":"20% discount for 1 year","payrollDiscountAmount":20.00,"payrollAnnualListPrice":null,"payrollAnnualDiscountedPrice":null,"offerTypeDescription":"Trial","offerType":"TRIAL","offerId":"a2y19000000LYsRAAW","offeredQBOProductId":null,"offeredQBOProduct":"QuickBooks Online Essentials","offeredPayrollProductId":null,"offeredPayrollProduct":"QuickBooks Online Payroll Enhanced","listPrice":26.95,"listCurrencyCode":null,"isTrial":true,"hasDiscountAsString":"false","hasDiscount":false,"displayProductName":"QuickBooks Online Essentials w/Enhanced Payroll","discountUnit":null,"discountType":null,"discountedPrice":null,"discountDuration":null,"discountDescription":null,"discountAmount":null,"currencyCode":"USD","bundleListPrice":65.95,"bundleDiscountedPrice":null,"bundleDiscountAmount":null,"annualListPrice":289.95,"annualDiscountedPrice":null},{"wrapperId":"offera2y19000000LZ53AAG_01ui000000MSJPHAA5_01u1900000BNsEVAA1","visible":true,"trialUnit":"Day","trialDuration":30,"trialDescription":"30 days","shortQBOProductName":"Essentials","shortPayrollProductName":"Full Service Payroll","segment":"New to QBO","region":"USA","qboProductPriceBookId":null,"qboProductPriceBookEntryId":"01ui000000MSJPHAA5","productCreateStr":"01ui000000MSJPHAA5|01u1900000BNsEVAA1|null|nullAmount|21.560000|null","productCode":"USE-T6P","payrollProductPriceBookId":null,"payrollProductPriceBookEntryId":"01u1900000BNsEVAA1","payrollListPrice":99.00,"payrollDiscountUnit":"MONTH","payrollDiscountType":"PERCENT","payrollDiscountedPrice":null,"payrollDiscountDuration":12,"payrollDiscountDescription":"20% discount for 1 year","payrollDiscountAmount":20.00,"payrollAnnualListPrice":null,"payrollAnnualDiscountedPrice":null,"offerTypeDescription":"Trial","offerType":"TRIAL","offerId":"a2y19000000LZ53AAG","offeredQBOProductId":null,"offeredQBOProduct":"QuickBooks Online Essentials","offeredPayrollProductId":null,"offeredPayrollProduct":"QuickBooks Online Payroll Full Service","listPrice":26.95,"listCurrencyCode":null,"isTrial":true,"hasDiscountAsString":"true","hasDiscount":true,"displayProductName":"QuickBooks Online Essentials w/Full Service Payroll","discountUnit":"DAY","discountType":"PERCENT","discountedPrice":21.560000,"discountDuration":365,"discountDescription":"20% discount for 1 year","discountAmount":20.00,"currencyCode":"USD","bundleListPrice":125.95,"bundleDiscountedPrice":100.760000,"bundleDiscountAmount":20.00,"annualListPrice":289.95,"annualDiscountedPrice":null},{"wrapperId":"offera2y19000000LZ53AAG_01ui000000MSJPHAA5_01u1900000BNsEUAA1","visible":true,"trialUnit":"Day","trialDuration":30,"trialDescription":"30 days","shortQBOProductName":"Essentials","shortPayrollProductName":"Enhanced Payroll","segment":"New to QBO","region":"USA","qboProductPriceBookId":null,"qboProductPriceBookEntryId":"01ui000000MSJPHAA5","productCreateStr":"01ui000000MSJPHAA5|01u1900000BNsEUAA1|null|nullAmount|21.560000|null","productCode":"USE-T6P","payrollProductPriceBookId":null,"payrollProductPriceBookEntryId":"01u1900000BNsEUAA1","payrollListPrice":39.00,"payrollDiscountUnit":"MONTH","payrollDiscountType":"PERCENT","payrollDiscountedPrice":null,"payrollDiscountDuration":12,"payrollDiscountDescription":"20% discount for 1 year","payrollDiscountAmount":20.00,"payrollAnnualListPrice":null,"payrollAnnualDiscountedPrice":null,"offerTypeDescription":"Trial","offerType":"TRIAL","offerId":"a2y19000000LZ53AAG","offeredQBOProductId":null,"offeredQBOProduct":"QuickBooks Online Essentials","offeredPayrollProductId":null,"offeredPayrollProduct":"QuickBooks Online Payroll Enhanced","listPrice":26.95,"listCurrencyCode":null,"isTrial":true,"hasDiscountAsString":"true","hasDiscount":true,"displayProductName":"QuickBooks Online Essentials w/Enhanced Payroll","discountUnit":"DAY","discountType":"PERCENT","discountedPrice":21.560000,"discountDuration":365,"discountDescription":"20% discount for 1 year","discountAmount":20.00,"currencyCode":"USD","bundleListPrice":65.95,"bundleDiscountedPrice":52.760000,"bundleDiscountAmount":20.00,"annualListPrice":289.95,"annualDiscountedPrice":null},{"wrapperId":"offera2y19000000LZ56AAG_01ui000000MSJOqAAP_01u1900000BNsEUAA1","visible":true,"trialUnit":"Day","trialDuration":30,"trialDescription":"30 days","shortQBOProductName":"Simple Start","shortPayrollProductName":"Enhanced Payroll","segment":"New to QBO","region":"USA","qboProductPriceBookId":null,"qboProductPriceBookEntryId":"01ui000000MSJOqAAP","productCreateStr":"01ui000000MSJOqAAP|01u1900000BNsEUAA1|null|nullAmount|10.360000|null","productCode":"USS-T2P","payrollProductPriceBookId":null,"payrollProductPriceBookEntryId":"01u1900000BNsEUAA1","payrollListPrice":39.00,"payrollDiscountUnit":"MONTH","payrollDiscountType":"PERCENT","payrollDiscountedPrice":null,"payrollDiscountDuration":12,"payrollDiscountDescription":"20% discount for 1 year","payrollDiscountAmount":20.00,"payrollAnnualListPrice":null,"payrollAnnualDiscountedPrice":null,"offerTypeDescription":"Trial","offerType":"TRIAL","offerId":"a2y19000000LZ56AAG","offeredQBOProductId":null,"offeredQBOProduct":"QuickBooks Online Simple Start","offeredPayrollProductId":null,"offeredPayrollProduct":"QuickBooks Online Payroll Enhanced","listPrice":12.95,"listCurrencyCode":null,"isTrial":true,"hasDiscountAsString":"true","hasDiscount":true,"displayProductName":"QuickBooks Online Simple Start w/Enhanced Payroll","discountUnit":"DAY","discountType":"PERCENT","discountedPrice":10.360000,"discountDuration":365,"discountDescription":"20% discount for 1 year","discountAmount":20.00,"currencyCode":"USD","bundleListPrice":51.95,"bundleDiscountedPrice":41.560000,"bundleDiscountAmount":20.00,"annualListPrice":137.95,"annualDiscountedPrice":null},{"wrapperId":"offera2y19000000LZ56AAG_01ui000000MSJOqAAP_01u1900000BNsEVAA1","visible":true,"trialUnit":"Day","trialDuration":30,"trialDescription":"30 days","shortQBOProductName":"Simple Start","shortPayrollProductName":"Full Service Payroll","segment":"New to QBO","region":"USA","qboProductPriceBookId":null,"qboProductPriceBookEntryId":"01ui000000MSJOqAAP","productCreateStr":"01ui000000MSJOqAAP|01u1900000BNsEVAA1|null|nullAmount|10.360000|null","productCode":"USS-T2P","payrollProductPriceBookId":null,"payrollProductPriceBookEntryId":"01u1900000BNsEVAA1","payrollListPrice":99.00,"payrollDiscountUnit":"MONTH","payrollDiscountType":"PERCENT","payrollDiscountedPrice":null,"payrollDiscountDuration":12,"payrollDiscountDescription":"20% discount for 1 year","payrollDiscountAmount":20.00,"payrollAnnualListPrice":null,"payrollAnnualDiscountedPrice":null,"offerTypeDescription":"Trial","offerType":"TRIAL","offerId":"a2y19000000LZ56AAG","offeredQBOProductId":null,"offeredQBOProduct":"QuickBooks Online Simple Start","offeredPayrollProductId":null,"offeredPayrollProduct":"QuickBooks Online Payroll Full Service","listPrice":12.95,"listCurrencyCode":null,"isTrial":true,"hasDiscountAsString":"true","hasDiscount":true,"displayProductName":"QuickBooks Online Simple Start w/Full Service Payroll","discountUnit":"DAY","discountType":"PERCENT","discountedPrice":10.360000,"discountDuration":365,"discountDescription":"20% discount for 1 year","discountAmount":20.00,"currencyCode":"USD","bundleListPrice":111.95,"bundleDiscountedPrice":89.560000,"bundleDiscountAmount":20.00,"annualListPrice":137.95,"annualDiscountedPrice":null},{"wrapperId":"offera2y19000000LYsdAAG_01ui000000MSJOqAAP_01u1900000BNsEUAA1","visible":true,"trialUnit":"Day","trialDuration":30,"trialDescription":"30 days","shortQBOProductName":"Simple Start","shortPayrollProductName":"Enhanced Payroll","segment":"New to QBO","region":"USA","qboProductPriceBookId":null,"qboProductPriceBookEntryId":"01ui000000MSJOqAAP","productCreateStr":"01ui000000MSJOqAAP|01u1900000BNsEUAA1|null|nullAmount|null|null","productCode":"USS-THP","payrollProductPriceBookId":null,"payrollProductPriceBookEntryId":"01u1900000BNsEUAA1","payrollListPrice":39.00,"payrollDiscountUnit":null,"payrollDiscountType":null,"payrollDiscountedPrice":null,"payrollDiscountDuration":null,"payrollDiscountDescription":null,"payrollDiscountAmount":null,"payrollAnnualListPrice":null,"payrollAnnualDiscountedPrice":null,"offerTypeDescription":"Trial","offerType":"TRIAL","offerId":"a2y19000000LYsdAAG","offeredQBOProductId":null,"offeredQBOProduct":"QuickBooks Online Simple Start","offeredPayrollProductId":null,"offeredPayrollProduct":"QuickBooks Online Payroll Enhanced","listPrice":12.95,"listCurrencyCode":null,"isTrial":true,"hasDiscountAsString":"false","hasDiscount":false,"displayProductName":"QuickBooks Online Simple Start w/Enhanced Payroll","discountUnit":null,"discountType":null,"discountedPrice":null,"discountDuration":null,"discountDescription":null,"discountAmount":null,"currencyCode":"USD","bundleListPrice":51.95,"bundleDiscountedPrice":null,"bundleDiscountAmount":null,"annualListPrice":120.00,"annualDiscountedPrice":null},{"wrapperId":"offera2y19000000LYsdAAG_01ui000000MSJOqAAP_01u1900000BNsEVAA1","visible":true,"trialUnit":"Day","trialDuration":30,"trialDescription":"30 days","shortQBOProductName":"Simple Start","shortPayrollProductName":"Full Service Payroll","segment":"New to QBO","region":"USA","qboProductPriceBookId":null,"qboProductPriceBookEntryId":"01ui000000MSJOqAAP","productCreateStr":"01ui000000MSJOqAAP|01u1900000BNsEVAA1|null|nullAmount|null|null","productCode":"USS-THP","payrollProductPriceBookId":null,"payrollProductPriceBookEntryId":"01u1900000BNsEVAA1","payrollListPrice":99.00,"payrollDiscountUnit":null,"payrollDiscountType":null,"payrollDiscountedPrice":null,"payrollDiscountDuration":null,"payrollDiscountDescription":null,"payrollDiscountAmount":null,"payrollAnnualListPrice":null,"payrollAnnualDiscountedPrice":null,"offerTypeDescription":"Trial","offerType":"TRIAL","offerId":"a2y19000000LYsdAAG","offeredQBOProductId":null,"offeredQBOProduct":"QuickBooks Online Simple Start","offeredPayrollProductId":null,"offeredPayrollProduct":"QuickBooks Online Payroll Full Service","listPrice":12.95,"listCurrencyCode":null,"isTrial":true,"hasDiscountAsString":"false","hasDiscount":false,"displayProductName":"QuickBooks Online Simple Start w/Full Service Payroll","discountUnit":null,"discountType":null,"discountedPrice":null,"discountDuration":null,"discountDescription":null,"discountAmount":null,"currencyCode":"USD","bundleListPrice":111.95,"bundleDiscountedPrice":null,"bundleDiscountAmount":null,"annualListPrice":120.00,"annualDiscountedPrice":null}],"visible":true,"title":"New to QBO - Trial","segment":"New to QBO","offerTypeDescription":"Trial","offerType":"TRIAL","isTrial":true,"countOfWrappers":8 }, {"wrappers": [{"wrapperId":"offera2y19000000LYrnAAG_01ui000000MSJPHAA5_null","visible":true,"trialUnit":"Day","trialDuration":0,"trialDescription":"0 day","shortQBOProductName":"Essentials","shortPayrollProductName":null,"segment":"New to QBO","region":"USA","qboProductPriceBookId":null,"qboProductPriceBookEntryId":"01ui000000MSJPHAA5","productCreateStr":null,"productCode":"USE-B90","payrollProductPriceBookId":null,"payrollProductPriceBookEntryId":null,"payrollListPrice":null,"payrollDiscountUnit":null,"payrollDiscountType":null,"payrollDiscountedPrice":null,"payrollDiscountDuration":null,"payrollDiscountDescription":null,"payrollDiscountAmount":null,"payrollAnnualListPrice":null,"payrollAnnualDiscountedPrice":null,"offerTypeDescription":"Buy Now","offerType":"PAID","offerId":"a2y19000000LYrnAAG","offeredQBOProductId":null,"offeredQBOProduct":"QuickBooks Online Essentials","offeredPayrollProductId":null,"offeredPayrollProduct":null,"listPrice":26.95,"listCurrencyCode":null,"isTrial":false,"hasDiscountAsString":"true","hasDiscount":true,"displayProductName":"QuickBooks Online Essentials","discountUnit":"DAY","discountType":"PERCENT","discountedPrice":16.170000,"discountDuration":365,"discountDescription":"40% discount for 1 year","discountAmount":40.00,"currencyCode":"USD","bundleListPrice":26.95,"bundleDiscountedPrice":16.170000,"bundleDiscountAmount":40.00,"annualListPrice":199.90,"annualDiscountedPrice":null},{"wrapperId":"offera2y19000000LYsYAAW_01ui000000MSJOqAAP_01u1900000BNsEVAA1","visible":true,"trialUnit":"Day","trialDuration":0,"trialDescription":"0 day","shortQBOProductName":"Simple Start","shortPayrollProductName":"Full Service Payroll","segment":"New to QBO","region":"USA","qboProductPriceBookId":null,"qboProductPriceBookEntryId":"01ui000000MSJOqAAP","productCreateStr":"01ui000000MSJOqAAP|01u1900000BNsEVAA1|null|nullAmount|6.475000|null","productCode":"USS-B2P","payrollProductPriceBookId":null,"payrollProductPriceBookEntryId":"01u1900000BNsEVAA1","payrollListPrice":99.00,"payrollDiscountUnit":"MONTH","payrollDiscountType":"PERCENT","payrollDiscountedPrice":null,"payrollDiscountDuration":6,"payrollDiscountDescription":"50% discount for 6 months","payrollDiscountAmount":50.00,"payrollAnnualListPrice":null,"payrollAnnualDiscountedPrice":null,"offerTypeDescription":"Buy Now","offerType":"PAID","offerId":"a2y19000000LYsYAAW","offeredQBOProductId":null,"offeredQBOProduct":"QuickBooks Online Simple Start","offeredPayrollProductId":null,"offeredPayrollProduct":"QuickBooks Online Payroll Full Service","listPrice":12.95,"listCurrencyCode":null,"isTrial":false,"hasDiscountAsString":"true","hasDiscount":true,"displayProductName":"QuickBooks Online Simple Start w/Full Service Payroll","discountUnit":"MONTH","discountType":"PERCENT","discountedPrice":6.475000,"discountDuration":6,"discountDescription":"50% discount for 6 months","discountAmount":50.00,"currencyCode":"USD","bundleListPrice":111.95,"bundleDiscountedPrice":55.975000,"bundleDiscountAmount":50.00,"annualListPrice":137.95,"annualDiscountedPrice":null},{"wrapperId":"offera2y19000000LYsYAAW_01ui000000MSJOqAAP_01u1900000BNsEUAA1","visible":true,"trialUnit":"Day","trialDuration":0,"trialDescription":"0 day","shortQBOProductName":"Simple Start","shortPayrollProductName":"Enhanced Payroll","segment":"New to QBO","region":"USA","qboProductPriceBookId":null,"qboProductPriceBookEntryId":"01ui000000MSJOqAAP","productCreateStr":"01ui000000MSJOqAAP|01u1900000BNsEUAA1|null|nullAmount|6.475000|null","productCode":"USS-B2P","payrollProductPriceBookId":null,"payrollProductPriceBookEntryId":"01u1900000BNsEUAA1","payrollListPrice":39.00,"payrollDiscountUnit":"MONTH","payrollDiscountType":"PERCENT","payrollDiscountedPrice":null,"payrollDiscountDuration":6,"payrollDiscountDescription":"50% discount for 6 months","payrollDiscountAmount":50.00,"payrollAnnualListPrice":null,"payrollAnnualDiscountedPrice":null,"offerTypeDescription":"Buy Now","offerType":"PAID","offerId":"a2y19000000LYsYAAW","offeredQBOProductId":null,"offeredQBOProduct":"QuickBooks Online Simple Start","offeredPayrollProductId":null,"offeredPayrollProduct":"QuickBooks Online Payroll Enhanced","listPrice":12.95,"listCurrencyCode":null,"isTrial":false,"hasDiscountAsString":"true","hasDiscount":true,"displayProductName":"QuickBooks Online Simple Start w/Enhanced Payroll","discountUnit":"MONTH","discountType":"PERCENT","discountedPrice":6.475000,"discountDuration":6,"discountDescription":"50% discount for 6 months","discountAmount":50.00,"currencyCode":"USD","bundleListPrice":51.95,"bundleDiscountedPrice":25.975000,"bundleDiscountAmount":50.00,"annualListPrice":137.95,"annualDiscountedPrice":null}],"visible":true,"title":"New to QBO - Buy Now","segment":"New to QBO","offerTypeDescription":"Buy Now","offerType":"PAID","isTrial":false,"countOfWrappers":3},
- CloudGeek
- March 05, 2016
- Like
- 0
- Continue reading or reply
Apex Callout Error : Access Denied though the remote site settings done and also request header has Uname and pswd
I am trying to make a callout to a Siebel Web Service to send the account created.
Here is what I did so far :
1. Generated the Classes from WSDL received from Siebel
2. Remote Site Setting Maintained with the URL ( http://192.168.XX.XX/SOME_PATH)
3. Created sample VF page for account Creation
4. Controller is implemented to perform call out with a @future Method
5. In the @future method, which is doing the callout actually, I have provided the access parameters for auth in the header like shown in the below code :
Still I am wondering why would this callout failed ?
Please suggest me what would have been missed or any workaround to get this resolved ?
Code of Controller :
public with sharing class calloutAccount {
public Account account { get; private set; }
public calloutAccount(ApexPages.StandardController controller)
{
Id id = ApexPages.currentPage().getParameters().get('id');
account = (id == null)? new Account() : [SELECT Name, AccountNumber, Account_Status__c FROM Account WHERE Id = :id];
}
public PageReference saveAccount()
{
try
{
upsert(account);
}
catch(System.DMLException e)
{
ApexPages.addMessages(e);
return null;
}
// After successful Save, navigate to the default view page
PageReference redirectSuccess = new ApexPages.StandardController(Account).view();
DoCallout(account.Id,account.Account_Status__c);
return (redirectSuccess);
}
public PageReference cancelAccount()
{
// After Cancel, navigate to the default view page
PageReference redirectSuccess = new ApexPages.StandardController(Account).view();
return (redirectSuccess);
}
@future(callout=true)
private static void DoCallout(Id actID,String actStatus)
{
Account account = [SELECT Name,AccountNumber,Account_Status__c FROM Account WHERE Id =: actID]; //Query for the inserted account ABOVE
System.debug(' @@@ acccount ID from FUTURE menthos() = '+ account.Id);
string UName = 'username';
string Passwd = 'password';
string SoapXMLBody;
SoapXMLBody = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:asi="http://siebel.com/asi/" xmlns:acc="http://www.siebel.com/xml/Account%20Interface"> <soapenv:Header> <wsse:Security xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/07/secext"> http://schemas.xmlsoap.org/ws/2002/07/secext <wsse:UsernameToken xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility"> <wsse:Username>'+ UName + '</wsse:Username> <wsse:Password Type="wsse:PasswordText">' + Passwd + '</wsse:Password> </wsse:UsernameToken> </wsse:Security> </soapenv:Header> <soapenv:Body> <asi:SiebelAccountSynchronize_Input> <acc:ListOfAccountInterface> <!--Zero or more repetitions:--> <acc:Account operation="insert"> <!--Optional:--> <acc:AccountId>' + account.AccountNumber + '</acc:AccountId> <acc:AccountStatus>' + account.Account_Status__c + '</acc:AccountStatus> <acc:Name>' + account.name + '</acc:Name> </acc:Account> </acc:ListOfAccountInterface> </asi:SiebelAccountSynchronize_Input> </soapenv:Body> </soapenv:Envelope>' ;
System.debug('@@@ SoapXMLBody = '+SoapXMLBody);
string SoapXML;
SoapXML = SoapXMLBody;
Integer ContentLength = 0;
ContentLength = SoapXML.length();
Http h = new Http();
HttpRequest req = new HttpRequest();
HttpResponse res = new HttpResponse();
req.setMethod('POST');
req.setEndPoint('http://192.XXX.XX.XX/eautomotive_enu/start.swe?');
req.setHeader('Content-type','text/xml');
req.setHeader('Content-Length',ContentLength.format());
req.setHeader('SoapAction','http://192.XXX.XX.XX/eautomotive_enu/start.swe?');
req.setBody(SoapXML);
System.Debug('@@@ req.getHeader'+req.getHeader('req.getHeader; '+'Content-Length'));
System.Debug('@@@ req: '+req);
System.Debug('@@@ req.getBody'+req.getBody());
res = h.send(req);
System.Debug('@@@ res: === '+res);
String auth = res.getBody();
System.Debug('@@@ Debug(auth:'+auth);
}
}
DEBUG LOG : for the response.
</head><body id=ERR_ACCESS_DENIED>
<div id="titles">
<h1>ERROR</h1>
<h2>The requested URL could not be retrieved</h2>
</div>
<hr>
<div id="content">
<p>The following error was encountered while trying to retrieve the URL: <a href="http://192.XXX.XX.XX/eautomotive_enu/start.swe?">http://192.XXX.XX.XX/eautomotive_enu/start.swe?</a></p>
<blockquote id="error">
<p><b>Access Denied.</b></p>
</blockquote>
<p>Access control configuration prevents your request from being allowed at this time. Please contact your service provider if you feel this is incorrect.</p>
<p>Your cache administrator is <a href="mailto:support@salesforce.com?subject=CacheErrorInfo%20-%20ERR_ACCESS_DENIED&body=CacheHost%3A%20proxy-was.net.salesforce.com%0D%0AErrPage%3A%20ERR_ACCESS_DENIED%0D%0AErr%3A%20%5Bnone%5D%0D%0ATimeStamp%3A%20Wed,%2017%20Feb%202016%2022%3A47%3A34%20GMT%0D%0A%0D%0AClientIP%3A%2010.242.12.23%0D%0A%0D%0AHTTP%20Request%3A%0D%0APOST%20%2Feautomotive_enu%2Fstart.swe%3F%20HTTP%2F1.1%0AContent-Type%3A%20text%2Fxml%0D%0AUser-Agent%3A%20SFDC-Callout%2F36.0%0D%0ASFDC_STACK_DEPTH%3A%201%0D%0AContent-Length%3A%20937%0D%0ASoapAction%3A%20http%3A%2F%2F192.168.10.14%2Feautomotive_enu%2Fstart.swe%3F%0D%0ACache-Control%3A%20no-cache%0D%0APragma%3A%20no-cache%0D%0AHost%3A%20192.168.10.14%0D%0AAccept%3A%20text%2Fhtml,%20image%2Fgif,%20image%2Fjpeg,%20*%3B%20q%3D.2,%20*%2F*%3B%20q%3D.2%0D%0AProxy-Connection%3A%20keep-alive%0D%0AX-Forwarded-For%3A%2010.242.64.10%0D%0A%0D%0A%0D%0A">support@salesforce.com</a>.</p>
<br>
</div>
<hr>
<div id="footer">
<p>Generated Wed, 17 Feb 2016 22:47:34 GMT by proxy-was.net.salesforce.com (squid)</p>
<!-- ERR_ACCESS_DENIED -->
</div>
</body></html>
- CloudGeek
- February 17, 2016
- Like
- 1
- Continue reading or reply
Apex Callout Error : Status = Forbidden 403 , Access Denied
I am trying to make a callout to a Siebel Web Service to send the account created.
Here is what I did so far :
1. Generated the Classes from WSDL received from Siebel
2. Remote Site Setting Maintained with the URL ( http://192.168.XX.XX/SOME_PATH)
3. Created sample VF page for account Creation
4. Controller is implemented to perform call out with a @future Method
5. In the @future method, which is doing the callout actually, I have provided the access parameters for auth in the header like shown in the below code :
Still I am wondering why would this callout failed ?
Please suggest me what would have been missed or any workaround to get this resolved ?
Code of Controller :
public with sharing class calloutAccount {
public Account account { get; private set; }
public calloutAccount(ApexPages.StandardController controller)
{
Id id = ApexPages.currentPage().getParameters().get('id');
account = (id == null)? new Account() : [SELECT Name, AccountNumber, Account_Status__c FROM Account WHERE Id = :id];
}
public PageReference saveAccount()
{
try
{
upsert(account);
}
catch(System.DMLException e)
{
ApexPages.addMessages(e);
return null;
}
// After successful Save, navigate to the default view page
PageReference redirectSuccess = new ApexPages.StandardController(Account).view();
DoCallout(account.Id,account.Account_Status__c);
return (redirectSuccess);
}
public PageReference cancelAccount()
{
// After Cancel, navigate to the default view page
PageReference redirectSuccess = new ApexPages.StandardController(Account).view();
return (redirectSuccess);
}
@future(callout=true)
private static void DoCallout(Id actID,String actStatus)
{
Account account = [SELECT Name,AccountNumber,Account_Status__c FROM Account WHERE Id =: actID]; //Query for the inserted account ABOVE
System.debug(' @@@ acccount ID from FUTURE menthos() = '+ account.Id);
string UName = 'username';
string Passwd = 'password';
string SoapXMLBody;
SoapXMLBody = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:asi="http://siebel.com/asi/" xmlns:acc="http://www.siebel.com/xml/Account%20Interface"> <soapenv:Header> <wsse:Security xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/07/secext"> http://schemas.xmlsoap.org/ws/2002/07/secext <wsse:UsernameToken xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility"> <wsse:Username>'+ UName + '</wsse:Username> <wsse:Password Type="wsse:PasswordText">' + Passwd + '</wsse:Password> </wsse:UsernameToken> </wsse:Security> </soapenv:Header> <soapenv:Body> <asi:SiebelAccountSynchronize_Input> <acc:ListOfAccountInterface> <!--Zero or more repetitions:--> <acc:Account operation="insert"> <!--Optional:--> <acc:AccountId>' + account.AccountNumber + '</acc:AccountId> <acc:AccountStatus>' + account.Account_Status__c + '</acc:AccountStatus> <acc:Name>' + account.name + '</acc:Name> </acc:Account> </acc:ListOfAccountInterface> </asi:SiebelAccountSynchronize_Input> </soapenv:Body> </soapenv:Envelope>' ;
System.debug('@@@ SoapXMLBody = '+SoapXMLBody);
string SoapXML;
SoapXML = SoapXMLBody;
Integer ContentLength = 0;
ContentLength = SoapXML.length();
Http h = new Http();
HttpRequest req = new HttpRequest();
HttpResponse res = new HttpResponse();
req.setMethod('POST');
req.setEndPoint('http://192.XXX.XX.XX/eautomotive_enu/start.swe?');
req.setHeader('Content-type','text/xml');
req.setHeader('Content-Length',ContentLength.format());
req.setHeader('SoapAction','http://192.XXX.XX.XX/eautomotive_enu/start.swe?');
req.setBody(SoapXML);
System.Debug('@@@ req.getHeader'+req.getHeader('req.getHeader; '+'Content-Length'));
System.Debug('@@@ req: '+req);
System.Debug('@@@ req.getBody'+req.getBody());
res = h.send(req);
System.Debug('@@@ res: === '+res);
String auth = res.getBody();
System.Debug('@@@ Debug(auth:'+auth);
}
}
- CloudGeek
- February 17, 2016
- Like
- 0
- Continue reading or reply
Pagereference methods test class help needed
I have a VF page which will take User name and PWD and a Login button and clear button and a forgot password link.
I have a controller which has the methods that are needed by those above buttons/links.
Login button --> loginVerify()
Clear --> clearFields()
forgotPassword ---> handleForgotPassword()
how to write the test class to get coverage for those pagereference methods ?
- CloudGeek
- August 10, 2015
- Like
- 0
- Continue reading or reply
Trigger on Attachment : Need input to verify on SOQL LIMIT / Bulkify for Delete Event
Here is my scenario:
I have a CUSTOM Object, when any attachment is uploaded for this CUSTOM OBJECT record, I am populating 2 fields with the values of attachment record onto the CUSTOM OBJECT via a trigger.
If the attachment is deleted there are below cases that needs to be implemented:
Case-1: If all the ATTACHMENT records are deleted for this CUSTOM OBJECT ---> CLEAR those fields
Case-2: If any other ATTACHMENT exists after deleteing a single attachment -- > Update these fields with the MOST RECENT ATTACHMENT values.
Here is the code which I have tried;
Below is the code I have tried - Can you help me understand whether this is going to hit any SOQL LIMIT ?
public void callAfterDeleteMethods(List<Attachment> AList)
{
//Local variables
set<Id> policyIDs = new set<Id>();
List<Attachment> attachList = new List<Attachment>();
Map<CUSTOM_OBJECT__c,List<Attachment>> Policy_TO_AttachmentList_Map = new Map<CUSTOM_OBJECT__c,List<Attachment>>(); //Map PUG-Object To Respective Attachment List
List<CUSTOM_OBJECT__c> pugList;
for(Attachment att : AList) //Taking All Policy IDs in Context
{
String objectAPIName = (String) att.ParentId.getSObjectType().getDescribe().getName();
System.debug('FROM Delete Method - objectAPIName = '+objectAPIName);
if(objectAPIName.equalsIgnoreCase('CUSTOM_OBJECT__c'))
policyIDs.add(att.ParentId);
}
if(policyIDs.size()>0) //if list of incoming list records to be deleted are not ZERO
{
pugList = [SELECT Id,Upload_Date__c,User__c FROM CUSTOM_OBJECT__c WHERE Id in: policyIDs]; //List to Hold PUG Objects
}
if(pugList.size()>0)
{
for(CUSTOM_OBJECT__c pug : pugList) //For each PUG Object get Attachments listed and Mapped
{
for(Attachment Att : [SELECT Id,CreatedDate,CreatedById FROM Attachment WHERE ParentId =: pug.Id ORDER BY createdDate DESC])
{
attachList.add(Att); //Make the list
}
Policy_TO_AttachmentList_Map.put(pug,attachList); //Policy-Object --> Corresponding Attachment List
}
for(CUSTOM_OBJECT__c pug : pugList)
{
if(Policy_TO_AttachmentList_Map.containsKey(pug))
{
if(Policy_TO_AttachmentList_Map.get(pug).size()>0) //if attachments exists for policy
{
Attachment temp = Policy_TO_AttachmentList_Map.get(pug).get(0);
pug.Upload_Date__c = (Datetime)temp.CreatedDate;
pug.User__c = temp.CreatedById;
policyUpdatelist.add(pug);
}
else
{
pug.Upload_Date__c = null;
pug.User__c = null;
policyUpdatelist.add(pug);
}
}
}
}
update policyUpdatelist;
firstRun = false; //To Avoid Recursive Calls in the Context
}//End-Of-Delete Method
/*******************************************************************************/
In the above code I had to write NESTED For Loops to fetch the Attachment list for every CUSTOM OBJECT RECORD.
for(CUSTOM_OBJECT__c pug : pugList) //For each PUG Object get Attachments listed and Mapped
{
for(Attachment Att : [SELECT Id,CreatedDate,CreatedById FROM Attachment WHERE ParentId =: pug.Id ORDER BY createdDate DESC])
{
attachList.add(Att); //Make the list
}
Policy_TO_AttachmentList_Map.put(pug,attachList); //Policy-Object --> Corresponding Attachment List
}
I think this may cause to hit SOQL LIMIT, Can any one suggest any other way to this ?
- CloudGeek
- July 16, 2015
- Like
- 0
- Continue reading or reply
Trigger on Attachment : help me bulkify
If there are no attachments I have to clear some fields up on delete.
if only a single atatchment deleted and still some attachments left on the custom object - get the recent attachment values and update on the object (Parent = Account)
Please check the trigger code below:
trigger TestAttachments on Attachment (after insert,after delete) {
//Variables
Map<Id,Attachment> Account_TO_Attachment = new Map<Id,Attachment>();
Map<Id,Integer> Account_TO_AttachmentCount = new Map<Id,Integer>();
List<Account> updateAccounts = new List<Account>();
List<ID> ListparentIDs = new List<ID>();
if(trigger.isinsert)
{
//Take all Account Attachments only
for(Attachment A : Trigger.new)
{
//Check the Parent Object and take only relevant
String objectAPIName = (String) A.ParentId.getSObjectType().getDescribe().getName();
System.debug('objectAPIName = '+ objectAPIName);
if(objectAPIName.equalsIgnoreCase('Account')){
Account_TO_Attachment.put(A.ParentId,A);
}
}
for(Account Acc : [SELECT Id,Upload_Date__c,Upload_User__c,Upload_Link__c FROM Account where Id in :Account_TO_Attachment.keyset()])
{
if(Account_TO_Attachment.containskey(Acc.id)){
Attachment temp = Account_TO_Attachment.get(Acc.Id);
Acc.Upload_Date__c = (DateTime)temp.CreatedDate;
Acc.Upload_User__c = temp.CreatedById;
updateAccounts.add(Acc);
}
}
if(updateAccounts.size() > 0)
update updateAccounts;
} //End-Of-isInsert
//Delete Event
if(trigger.isdelete)
{
for(Attachment A : Trigger.old)
{
ListparentIDs.add(A.ParentId);
}
//List<Proposal__c> co = [select id, Attachment_Added__c from Proposal__c where id =: Trigger.old[0].ParentId];
List<Account> co = [select id,Upload_Date__c,Upload_User__c from Account where id in: ListparentIDs];
if(co.size()>0)
{
List<Attachment> allChildren = [Select id from Attachment where parentid = :co[0].id];
if(allChildren != null && allChildren.size() == 0)
//co[0].Attachment_Added__c = false;
update co;
}
} //End Of Delete
}
- CloudGeek
- July 14, 2015
- Like
- 0
- Continue reading or reply
Error: caused by: System.QueryException: Non-selective query against large object type (more than 100000 rows). Consider an indexed filter or contact salesforce.com about custom indexing.
We have an after update trigger which pulls some tasks based on one field on Task record and update a field on opportunity.
The following loop:
for(Task t :[SELECT id,subject,WhatId,createdDate,Distributor_To_See__c FROM Task WHERE WhatId IN :opportunityIds AND Distributor_To_See__c = 'DSC' LIMIT 49999])
{
If(oppIdToTasks.ContainsKey(t.WhatId))
{
oppIdToTasks.get(t.WhatId).add(t);
}
else
{
List<Task> tempList = new List<Task>();
tempList.add(t);
oppIdToTasks.put(t.WhatId,tempList);
}
}
that Query line in bold above - is causing this error.
Update error code CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY: AutoShareTasks: execution of AfterUpdate
caused by: System.QueryException: Non-selective query against large object type (more than 100000 rows). Consider an indexed filter or contact salesforce.com about custom indexing.
Even if a field is indexed a filter might still not be selective when:
1. The filter value includes null (for instance binding with a list that contains null)
2. Data skew exists whereby the number of matching rows is very large (for instance, filtering for a particular foreign key value that occurs many times)
Trigger.AutoShareTasks: line 23, column 1
Any one suggest what needs to be done for this ?
Thank you.
- CloudGeek
- October 15, 2014
- Like
- 0
- Continue reading or reply
Salesforce to Salesforce Integration : Validation Rules
We are implementing SF to SF integration with our partners in business.
We enabled the set up and Configured the settings and were able to share opportunities.
The requirement is to write a validation rule which should allow only certain close reasons when it is shared with the partner.
How could we identify that the opportunity is being shared technically (I mean is there any field that I can use to identify it is shared/not ) ?
Please help in this regard.
Thanks in advance.
BR,
Venkat K
- CloudGeek
- September 04, 2014
- Like
- 0
- Continue reading or reply
How to access Person Account Email field from Opportunity in an Apex trigger
I want to implement an email program to send an email to the customer , in my company customers are created as Person Accounts.
When I use the following code , I see the null in the result .. . please help.
I used the code below:
String customerEmailID = ' ' ;
for (Opportunity opp: Trigger.new)
{
Opportunity oldOpp = Trigger.oldMap.get(opp.ID);
customerEmailID = opp.account.PersonEmail; // Here When I use this way - it's getting PersonAccount Email ID - it gives NULL
if(opp.Status__c == 'XXXXXX' && oldOpp.Status__c == 'YYYYYY' && customerEmailID != null )
{
helper.sendEmail(customerEmailID);
}
else
{
helper.createTask(' No Email Sent - Customer Email ID Missing');
}
Can anyone help me get this done ?
Thanks in advance.
- CloudGeek
- July 17, 2014
- Like
- 0
- Continue reading or reply
Apex Callout Error : Access Denied though the remote site settings done and also request header has Uname and pswd
I am trying to make a callout to a Siebel Web Service to send the account created.
Here is what I did so far :
1. Generated the Classes from WSDL received from Siebel
2. Remote Site Setting Maintained with the URL ( http://192.168.XX.XX/SOME_PATH)
3. Created sample VF page for account Creation
4. Controller is implemented to perform call out with a @future Method
5. In the @future method, which is doing the callout actually, I have provided the access parameters for auth in the header like shown in the below code :
Still I am wondering why would this callout failed ?
Please suggest me what would have been missed or any workaround to get this resolved ?
Code of Controller :
public with sharing class calloutAccount {
public Account account { get; private set; }
public calloutAccount(ApexPages.StandardController controller)
{
Id id = ApexPages.currentPage().getParameters().get('id');
account = (id == null)? new Account() : [SELECT Name, AccountNumber, Account_Status__c FROM Account WHERE Id = :id];
}
public PageReference saveAccount()
{
try
{
upsert(account);
}
catch(System.DMLException e)
{
ApexPages.addMessages(e);
return null;
}
// After successful Save, navigate to the default view page
PageReference redirectSuccess = new ApexPages.StandardController(Account).view();
DoCallout(account.Id,account.Account_Status__c);
return (redirectSuccess);
}
public PageReference cancelAccount()
{
// After Cancel, navigate to the default view page
PageReference redirectSuccess = new ApexPages.StandardController(Account).view();
return (redirectSuccess);
}
@future(callout=true)
private static void DoCallout(Id actID,String actStatus)
{
Account account = [SELECT Name,AccountNumber,Account_Status__c FROM Account WHERE Id =: actID]; //Query for the inserted account ABOVE
System.debug(' @@@ acccount ID from FUTURE menthos() = '+ account.Id);
string UName = 'username';
string Passwd = 'password';
string SoapXMLBody;
SoapXMLBody = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:asi="http://siebel.com/asi/" xmlns:acc="http://www.siebel.com/xml/Account%20Interface"> <soapenv:Header> <wsse:Security xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/07/secext"> http://schemas.xmlsoap.org/ws/2002/07/secext <wsse:UsernameToken xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility"> <wsse:Username>'+ UName + '</wsse:Username> <wsse:Password Type="wsse:PasswordText">' + Passwd + '</wsse:Password> </wsse:UsernameToken> </wsse:Security> </soapenv:Header> <soapenv:Body> <asi:SiebelAccountSynchronize_Input> <acc:ListOfAccountInterface> <!--Zero or more repetitions:--> <acc:Account operation="insert"> <!--Optional:--> <acc:AccountId>' + account.AccountNumber + '</acc:AccountId> <acc:AccountStatus>' + account.Account_Status__c + '</acc:AccountStatus> <acc:Name>' + account.name + '</acc:Name> </acc:Account> </acc:ListOfAccountInterface> </asi:SiebelAccountSynchronize_Input> </soapenv:Body> </soapenv:Envelope>' ;
System.debug('@@@ SoapXMLBody = '+SoapXMLBody);
string SoapXML;
SoapXML = SoapXMLBody;
Integer ContentLength = 0;
ContentLength = SoapXML.length();
Http h = new Http();
HttpRequest req = new HttpRequest();
HttpResponse res = new HttpResponse();
req.setMethod('POST');
req.setEndPoint('http://192.XXX.XX.XX/eautomotive_enu/start.swe?');
req.setHeader('Content-type','text/xml');
req.setHeader('Content-Length',ContentLength.format());
req.setHeader('SoapAction','http://192.XXX.XX.XX/eautomotive_enu/start.swe?');
req.setBody(SoapXML);
System.Debug('@@@ req.getHeader'+req.getHeader('req.getHeader; '+'Content-Length'));
System.Debug('@@@ req: '+req);
System.Debug('@@@ req.getBody'+req.getBody());
res = h.send(req);
System.Debug('@@@ res: === '+res);
String auth = res.getBody();
System.Debug('@@@ Debug(auth:'+auth);
}
}
DEBUG LOG : for the response.
</head><body id=ERR_ACCESS_DENIED>
<div id="titles">
<h1>ERROR</h1>
<h2>The requested URL could not be retrieved</h2>
</div>
<hr>
<div id="content">
<p>The following error was encountered while trying to retrieve the URL: <a href="http://192.XXX.XX.XX/eautomotive_enu/start.swe?">http://192.XXX.XX.XX/eautomotive_enu/start.swe?</a></p>
<blockquote id="error">
<p><b>Access Denied.</b></p>
</blockquote>
<p>Access control configuration prevents your request from being allowed at this time. Please contact your service provider if you feel this is incorrect.</p>
<p>Your cache administrator is <a href="mailto:support@salesforce.com?subject=CacheErrorInfo%20-%20ERR_ACCESS_DENIED&body=CacheHost%3A%20proxy-was.net.salesforce.com%0D%0AErrPage%3A%20ERR_ACCESS_DENIED%0D%0AErr%3A%20%5Bnone%5D%0D%0ATimeStamp%3A%20Wed,%2017%20Feb%202016%2022%3A47%3A34%20GMT%0D%0A%0D%0AClientIP%3A%2010.242.12.23%0D%0A%0D%0AHTTP%20Request%3A%0D%0APOST%20%2Feautomotive_enu%2Fstart.swe%3F%20HTTP%2F1.1%0AContent-Type%3A%20text%2Fxml%0D%0AUser-Agent%3A%20SFDC-Callout%2F36.0%0D%0ASFDC_STACK_DEPTH%3A%201%0D%0AContent-Length%3A%20937%0D%0ASoapAction%3A%20http%3A%2F%2F192.168.10.14%2Feautomotive_enu%2Fstart.swe%3F%0D%0ACache-Control%3A%20no-cache%0D%0APragma%3A%20no-cache%0D%0AHost%3A%20192.168.10.14%0D%0AAccept%3A%20text%2Fhtml,%20image%2Fgif,%20image%2Fjpeg,%20*%3B%20q%3D.2,%20*%2F*%3B%20q%3D.2%0D%0AProxy-Connection%3A%20keep-alive%0D%0AX-Forwarded-For%3A%2010.242.64.10%0D%0A%0D%0A%0D%0A">support@salesforce.com</a>.</p>
<br>
</div>
<hr>
<div id="footer">
<p>Generated Wed, 17 Feb 2016 22:47:34 GMT by proxy-was.net.salesforce.com (squid)</p>
<!-- ERR_ACCESS_DENIED -->
</div>
</body></html>
- CloudGeek
- February 17, 2016
- Like
- 1
- Continue reading or reply
Lwc return value is [object Object]
Hi everyone can you please help me i am getting object object as return value.
js code :
import { LightningElement, wire, track } from 'lwc';
import mapDemo from '@salesforce/apex/Utility.mapDemo';
export default class LwcUtility extends LightningElement {
@track name="Yogesh Upadhyay";
@track message="Welcome";
@track record;
@track error;
@track maps;
@track conList= [
{
id:'12345678',
name:'One two ka four',
Phone:'100'
},
{
id:'12345678',
name:'One two ka five',
Phone:'101'
},
{
id:'12345678',
name:'One two ka six',
Phone:'102'
}
];
@wire(mapDemo)
result({error,data}){
if(data){
this.record = data;
console.log("return is "+this.record);
JSON.stringify("hello",data);
}
if(error){
this.error= error;
console.log("retrun is "+this.error);
}
}
}
apex :
public with sharing class Utility {
public Utility() {
}
@AuraEnabled
public static map<String,Integer> mapDemo(){
map<String,Integer> testmap = new map<String,Integer>();
testmap.put('avab',2);
testmap.put('avab',2);
testmap.put('avab',2);
testmap.put('avab',2);
return testmap;
}
}
- Yogesh Upadhyay 14
- February 15, 2020
- Like
- 0
- Continue reading or reply
How to display the table as a vertical in visual force page.
i want display the table as a vertical in visualforce page. pls demonstration this how to we can achive this.Give me example code
Thanks,
Chanti
- chanti k
- March 02, 2017
- Like
- 0
- Continue reading or reply
How to chain job using Queueable Apex
public class MyQueueable1 implements Queueable { Public Static list < Account > acclist = new list < Account > (); public MyQueueable1() { } public void execute(QueueableContext context) { System.enqueueJob(new MyQueueable2()); } public class MyQueueable2 implements Queueable { public MyQueueable2() { } public void execute(QueueableContext context) { List < Account > a = [SELECT Id, Name FROM Account WHERE Id =: acclist]; } } }
- Jack A 2
- February 28, 2017
- Like
- 1
- Continue reading or reply
What is the difference between Field required and Field Set required
If an field is defined as required, will it be required without any configure in field set?
- Kenneth Wang 1
- July 15, 2016
- Like
- 0
- Continue reading or reply
copying fields into a task
Approach 1: Setup -> Customize -> Activities -> Activity Custom Fields. Create New Field, select text, try to enter formula pointing to Account object's field. I get an error: "Field does not exist."
Approach 2: Setup -> Create -> Workflow -> Field Updates. Use "formula" to set up new value, but get same error: "Field does not exist."
How can I connect my custom Accounts object to tasks I create? I'm sure it's obvious and I'm just missing something....
- Tony Boyd
- May 13, 2016
- Like
- 0
- Continue reading or reply
when i have use trigger.new and trigger.old please can any one explain indetailed with small scenarios please?
- Ashritha Reddy
- May 13, 2016
- Like
- 0
- Continue reading or reply
if I made changes on OWD & then make changes in profile for the same object what will happen?
- ashish jadhav 9
- May 11, 2016
- Like
- 0
- Continue reading or reply
Where i am learn Salesforce Test Classes
Thanks & Regards
Jasveer Singh
- Jasveer Singh
- May 11, 2016
- Like
- 0
- Continue reading or reply
- puli raju
- May 11, 2016
- Like
- 0
- Continue reading or reply
Please answer me
- Ashritha Reddy
- May 11, 2016
- Like
- 0
- Continue reading or reply
bind recordtype to picklist
My requirement is to bind recordtypes to an picklist and display in visual force page
I have the code show in this post.
public with sharing class recordtypepicklist { public list<SelectOption> getRecordTypes() { list<SelectOption> options = new list<SelectOption>(); for(RecordType sRecordType:[select ID,Name from RecordType where SObjectType='Contact']) { options.add(new SelectOption(sRecordType.ID,sRecordType.Name)); } return options; } }I am getting an error as Error: Compile Error: Variable does not exist: ID at line 9 column 38
Its coming from the statement inside the for loop.
Pls let me know how to resolve this.
pooja
- pooja biswas
- May 11, 2016
- Like
- 0
- Continue reading or reply
get custom fields
I am understading the basics of metadata of fetching account info.
below is the code
public class selectAllSOQLExampleController { String SobjectApiName = 'Account'; List<Account> accList=new List<Account>(); public String query{get;set;} public List<Account> getAccList() { Map<String,Schema.SObjectType> schemaMap=Schema.getGlobalDescribe(); Map<String, Schema.SObjectField> fieldMap = schemaMap.get(SobjectApiName).getDescribe().fields.getMap(); String commaSeparatedFields = ''; for(String fieldName : fieldMap.keyset()) { if(commaSeparatedFields == null || commaSeparatedFields == '') { commaSeparatedFields = fieldName; } else { commaSeparatedFields = commaSeparatedFields + ', ' + fieldName; } } query = 'select ' + commaSeparatedFields + ' from ' + SobjectApiName + ' Limit 10 '; accList = Database.query(query); return accList; } } <apex:page controller="selectAllSOQLExampleController"> <apex:form> <apex:pageBlock> <apex:pageBlockSection title="Account table" columns="1" collapsible="false"> <apex:pageBlockTable value="{!accList}" var="acc"> <apex:column value="{!acc.name}"/> <apex:column value="{!acc.phone}"/> <apex:column value="{!acc.rating}"/> <apex:column value="{!acc.industry}"/> <apex:column value="{!acc.accountnumber}"/> </apex:pageBlockTable> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>My requirement is I want to display custom fields also.
Pls help me in tweeking my code.
pooja
- pooja biswas
- May 10, 2016
- Like
- 0
- Continue reading or reply
Getter and Setter in Apex
Very basic question and find difficult to understand. And please let me know, when to use what?
What is the difference between these 2 coding structures:
1. public String name {
get { return name;}
set { name = value;}
2. public String name{get;set;}
- PlatFormCloud
- May 10, 2016
- Like
- 1
- Continue reading or reply
Test class is no longer recognizing an inserted test Account record
- mstarks
- May 09, 2016
- Like
- 0
- Continue reading or reply
Standard Way to override view button
I want to override view button(Standard detail page) for certain profiles but not for all. What is the standard way to override? I am thinking to use nooverride=1 but not sure if it is a URL hack or standard way. Any help would be appreciated.
Thanks,
- sachin kadian 5
- May 08, 2016
- Like
- 0
- Continue reading or reply
Display opportunity product related list on visualforce page for oppotunity
How do I display opportunity product related list on a visualforce page? I am trying to use <apex:relatedlist> markup but its not working. I guess its because both are standard objects. What is the best way to display opportunity product related list on visualforce page? How about using <apex:facet> markup. But Opportunity.Product2 gives me an error (invalid field).
Thanks,
Rick
- Urvik
- May 05, 2016
- Like
- 0
- Continue reading or reply
How to chain job using Queueable Apex
public class MyQueueable1 implements Queueable { Public Static list < Account > acclist = new list < Account > (); public MyQueueable1() { } public void execute(QueueableContext context) { System.enqueueJob(new MyQueueable2()); } public class MyQueueable2 implements Queueable { public MyQueueable2() { } public void execute(QueueableContext context) { List < Account > a = [SELECT Id, Name FROM Account WHERE Id =: acclist]; } } }
- Jack A 2
- February 28, 2017
- Like
- 1
- Continue reading or reply
Announcing the Force.com Sites Developer Challenge Guide
The challenge page has all the details, but in short the rules are pretty simple: "You can use any or all parts of the Force.com platform, as long as you use Force.com Sites, and you can submit as many applications as you like." And you have a month to do it in - submissions close on
That's it! Create anything, as long as you use Force.com Sites. And Sites enables an entirely new breed of applications, so I'm really looking forward to seeing what you folk submit. If you're new to Sites and Visualforce, we have a couple of challenges that you can use to get you started. See the Developer Challenge Guide for details.
Oh, we'll be handing out a number of prizes too! Developer Challenge t-shirts, iPod Nanos, iPod Touches and more!
Here are some handy resources:
- The Force.com Sites home page
- The Developer Challenge home page
- An Introduction to Visualforce - the user interface technology underlying Sites
- Our documentation page, which points to a number of useful books
Jon
Message Edited by Tran Man on 01-06-2009 04:16 PM
- Jon Mountjoy_
- December 08, 2008
- Like
- 3
- Continue reading or reply