-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
5Questions
-
4Replies
REST Post from SFDC using SSL certs provided by destination vendor
Hi folks,
I was having a bit of difficulty figuring out how to implement an integration and I was hoping someone might have some insight. What I need to to is make an HTTPS callout from SFDC to another system where there system is expecting an incoming XML file where the connection is secured with SSL and they provide SSL files. I am unaware of how to use their SSL files within SFDC and my APEX code. I have seen plenty of discussions of how to generate SSL certificates in SFDC but I assume that I should just be using theirs and I am not sure how. I have also seen many examples going from an external source and posting in to SFDC but not much the other way around. I have also seen that this may be how to use it in APEX once it is generated but that same material only explains how to create it in SFDC, not how to use a provided certificate.
below is my current code which is hitting their server but returning an unauthorized 401 error. Sensitive or unnecessary parts have been changed/removed.
Please find the following information related to our SSL certificates and authentication:
______________________________________________________________________________________________
Attached are the certificates:
STAR.MANAGEMENTDYNAMICS.COM.zip: This has a wild card certificate; like: *.managementdynamics.com. It works for both eoduat (test) and eod (production).
root-intermediate-certificates.zip: This has three certificate files; one root and two intermediate
Notes:
Our certificates are issued by:
Network Solutions CA company
Network Solutions CA company gets their certificate signed from UTN-USERFIRST CA company
UTN-USERFIRST CA company gets their certificate signed from AddTrustExternal CA (this is root CA)
In order to make a secured connection, your certificate store must have intermediate & root certificates. If you already have these, there is no need to import them.
The Actual SSL Certificates in STAR.MANAGEMENTDYNAMICS.COM.zip are valid until 01/16/2018.
Our servers do not support non-SSL connections. While sending the inbound XML request, you have to set the Authorization HTTP header in the following format in order to successfully logon (Reference Section 3.1.3, page 28 of Integration guide):
Basic<Space><Base 64 Encode(UserName:Password)>
Be sure to post your files to the correct URL based on whether you want to send to the test or the production environment, and be sure you use the correct UserName and Password for each environment.
______________________________________________________________________________________________
finally, a slightly off topic question, I have set them up as a remote site but I just used the base URL of their company, I did not include the application context after the .com that I use for the endpoint connection. Is this correct or do I put the whole endpoint connection for the remote site? Anyway, any ideas or suggestions would be greatly appreciated. Thanks!
I was having a bit of difficulty figuring out how to implement an integration and I was hoping someone might have some insight. What I need to to is make an HTTPS callout from SFDC to another system where there system is expecting an incoming XML file where the connection is secured with SSL and they provide SSL files. I am unaware of how to use their SSL files within SFDC and my APEX code. I have seen plenty of discussions of how to generate SSL certificates in SFDC but I assume that I should just be using theirs and I am not sure how. I have also seen many examples going from an external source and posting in to SFDC but not much the other way around. I have also seen that this may be how to use it in APEX once it is generated but that same material only explains how to create it in SFDC, not how to use a provided certificate.
req.setClientCertificateName('DocSampleCert');
below is my current code which is hitting their server but returning an unauthorized 401 error. Sensitive or unnecessary parts have been changed/removed.
@future (callout=true) public static void basicAuthCallout(String name, Id id){ system.debug('point 3'); String xmlToEscape = '<?xml version="1.0" encoding="UTF-8"?>' + '<PartnerRecord version="2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="PartnerXml.xsd">' + '<PartnerId>' + id + '</PartnerId>' + '<OrgCode></OrgCode>' + '<CompanyCode></CompanyCode>' + '<Name>' + name + '</Name>' + // unnecessary parts of XML string removed '</PartnerRecord>'; String xmlToSend = xmlToEscape.escapeXml(); HttpRequest req = new HttpRequest(); req.setEndpoint('https://example integration endpoint URL'); req.setMethod('POST'); // Specify the required user name and password to access the endpoint // As well as the header and header information String username = 'exampleUserName'; String password = 'examplePassword'; Blob headerValue = Blob.valueOf(username + ':' + password); String authorizationHeader = 'BASIC ' + EncodingUtil.base64Encode(headerValue); req.setHeader('Authorization', authorizationHeader); req.setBody(xmlToSend); // Create a new http object to send the request object // A response object is generated as a result of the request Http http = new Http(); HttpResponse res = new HttpResponse(); try { res = http.send(req); } catch(System.CalloutException e) { System.debug('Callout error: '+ e); System.debug(res.toString()); } //HTTPResponse res = http.send(req); System.debug(res.getBody()); }and here is the info that I got from the 3rd party as well as 2 zip files:
Please find the following information related to our SSL certificates and authentication:
______________________________________________________________________________________________
Attached are the certificates:
STAR.MANAGEMENTDYNAMICS.COM.zip: This has a wild card certificate; like: *.managementdynamics.com. It works for both eoduat (test) and eod (production).
root-intermediate-certificates.zip: This has three certificate files; one root and two intermediate
Notes:
Our certificates are issued by:
Network Solutions CA company
Network Solutions CA company gets their certificate signed from UTN-USERFIRST CA company
UTN-USERFIRST CA company gets their certificate signed from AddTrustExternal CA (this is root CA)
In order to make a secured connection, your certificate store must have intermediate & root certificates. If you already have these, there is no need to import them.
The Actual SSL Certificates in STAR.MANAGEMENTDYNAMICS.COM.zip are valid until 01/16/2018.
Our servers do not support non-SSL connections. While sending the inbound XML request, you have to set the Authorization HTTP header in the following format in order to successfully logon (Reference Section 3.1.3, page 28 of Integration guide):
Basic<Space><Base 64 Encode(UserName:Password)>
Be sure to post your files to the correct URL based on whether you want to send to the test or the production environment, and be sure you use the correct UserName and Password for each environment.
______________________________________________________________________________________________
finally, a slightly off topic question, I have set them up as a remote site but I just used the base URL of their company, I did not include the application context after the .com that I use for the endpoint connection. Is this correct or do I put the whole endpoint connection for the remote site? Anyway, any ideas or suggestions would be greatly appreciated. Thanks!
- Chris Lites
- July 27, 2015
- Like
- 0
REST Post from SFDC using 3rd party provided SSL
Hi folks,
I was having a bit of difficulty figuring out how to implement an integration and I was hoping someone might have some insight. What I need to to is make an HTTPS callout from SFDC to another system where there system is expecting an incoming XML file where the connection is secured with SSL and they provide SSL files. I am unaware of how to use their SSL files within SFDC and my APEX code. I have seen plenty of discussions of how to generate SSL certificates in SFDC but I assume that I should just be using theirs and I am not sure how. I have also seen many examples going from an external source and posting in to SFDC but not much the other way around. I have also seen that this may be how to use it in APEX once it is generated but that same material only explains how to create it in SFDC, not how to use a provided certificate.
below is my current code which is hitting their server but returning an unauthorized 401 error. Sensitive or unnecessary parts have been changed/removed.
and here is the info that I got from the 3rd party as well as 2 zip files:
Please find the following information related to our SSL certificates and authentication:
______________________________________________________________________________________________
Attached are the certificates:
STAR.MANAGEMENTDYNAMICS.COM.zip: This has a wild card certificate; like: *.managementdynamics.com. It works for both eoduat (test) and eod (production).
root-intermediate-certificates.zip: This has three certificate files; one root and two intermediate
Notes:
Our certificates are issued by:
Network Solutions CA company
Network Solutions CA company gets their certificate signed from UTN-USERFIRST CA company
UTN-USERFIRST CA company gets their certificate signed from AddTrustExternal CA (this is root CA)
In order to make a secured connection, your certificate store must have intermediate & root certificates. If you already have these, there is no need to import them.
The Actual SSL Certificates in STAR.MANAGEMENTDYNAMICS.COM.zip are valid until 01/16/2018.
Our servers do not support non-SSL connections. While sending the inbound XML request, you have to set the Authorization HTTP header in the following format in order to successfully logon (Reference Section 3.1.3, page 28 of Integration guide):
Basic<Space><Base 64 Encode(UserName:Password)>
Be sure to post your files to the correct URL based on whether you want to send to the test or the production environment, and be sure you use the correct UserName and Password for each environment.
______________________________________________________________________________________________
finally, a slightly off topic question, I have set them up as a remote site but I just used the base URL of their company, I did not include the application context after the .com that I use for the endpoint connection. Is this correct or do I put the whole endpoint connection for the remote site? Anyway, any ideas or suggestions would be greatly appreciated. Thanks!
I was having a bit of difficulty figuring out how to implement an integration and I was hoping someone might have some insight. What I need to to is make an HTTPS callout from SFDC to another system where there system is expecting an incoming XML file where the connection is secured with SSL and they provide SSL files. I am unaware of how to use their SSL files within SFDC and my APEX code. I have seen plenty of discussions of how to generate SSL certificates in SFDC but I assume that I should just be using theirs and I am not sure how. I have also seen many examples going from an external source and posting in to SFDC but not much the other way around. I have also seen that this may be how to use it in APEX once it is generated but that same material only explains how to create it in SFDC, not how to use a provided certificate.
req.setClientCertificateName('DocSampleCert');
below is my current code which is hitting their server but returning an unauthorized 401 error. Sensitive or unnecessary parts have been changed/removed.
@future (callout=true) public static void basicAuthCallout(String name, Id id){ system.debug('point 3'); String xmlToEscape = '<?xml version="1.0" encoding="UTF-8"?>' + '<PartnerRecord version="2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="PartnerXml.xsd">' + '<PartnerId>' + id + '</PartnerId>' + '<OrgCode></OrgCode>' + '<CompanyCode></CompanyCode>' + '<Name>' + name + '</Name>' + // unnecessary parts of XML string removed '</PartnerRecord>'; String xmlToSend = xmlToEscape.escapeXml(); HttpRequest req = new HttpRequest(); req.setEndpoint('https://example integration endpoint URL'); req.setMethod('POST'); // Specify the required user name and password to access the endpoint // As well as the header and header information String username = 'exampleUserName'; String password = 'examplePassword'; Blob headerValue = Blob.valueOf(username + ':' + password); String authorizationHeader = 'BASIC ' + EncodingUtil.base64Encode(headerValue); req.setHeader('Authorization', authorizationHeader); req.setBody(xmlToSend); // Create a new http object to send the request object // A response object is generated as a result of the request Http http = new Http(); HttpResponse res = new HttpResponse(); try { res = http.send(req); } catch(System.CalloutException e) { System.debug('Callout error: '+ e); System.debug(res.toString()); } //HTTPResponse res = http.send(req); System.debug(res.getBody()); }
and here is the info that I got from the 3rd party as well as 2 zip files:
Please find the following information related to our SSL certificates and authentication:
______________________________________________________________________________________________
Attached are the certificates:
STAR.MANAGEMENTDYNAMICS.COM.zip: This has a wild card certificate; like: *.managementdynamics.com. It works for both eoduat (test) and eod (production).
root-intermediate-certificates.zip: This has three certificate files; one root and two intermediate
Notes:
Our certificates are issued by:
Network Solutions CA company
Network Solutions CA company gets their certificate signed from UTN-USERFIRST CA company
UTN-USERFIRST CA company gets their certificate signed from AddTrustExternal CA (this is root CA)
In order to make a secured connection, your certificate store must have intermediate & root certificates. If you already have these, there is no need to import them.
The Actual SSL Certificates in STAR.MANAGEMENTDYNAMICS.COM.zip are valid until 01/16/2018.
Our servers do not support non-SSL connections. While sending the inbound XML request, you have to set the Authorization HTTP header in the following format in order to successfully logon (Reference Section 3.1.3, page 28 of Integration guide):
Basic<Space><Base 64 Encode(UserName:Password)>
Be sure to post your files to the correct URL based on whether you want to send to the test or the production environment, and be sure you use the correct UserName and Password for each environment.
______________________________________________________________________________________________
finally, a slightly off topic question, I have set them up as a remote site but I just used the base URL of their company, I did not include the application context after the .com that I use for the endpoint connection. Is this correct or do I put the whole endpoint connection for the remote site? Anyway, any ideas or suggestions would be greatly appreciated. Thanks!
- Chris Lites
- July 24, 2015
- Like
- 0
inputField and outputField alignment help needed
Hi,
I am having a bit of an issue on an inline VF page that I am making that I was hoping someone might have some ideas on how to solve. Basically, I have some fields that are conditionally rendered as either input or output fields. These fields are contained within pageBlockSectionItem tags (so that I could bring in the help text), within pageBlockSection tags, inside column tags, in a pageBlockTable. My issue is that the outputFields seem to always display center justified but the input fields display more like they are left justified which I prefer.
I have tried playing with column widths, adding css either inline or in style tags, etc. but cannot seem to get these to behave the way I would like. It should also be mentioned that I did have showheader="false" sidebar="false" in the page tag previously but that made the help bubbles go away so that is not an option. Any thoughts would be greatly appreciated. Page code and picture examples are below. Let me know if you would like me to post up the controller code as well but I thought it was most likely unnecessary.
I am having a bit of an issue on an inline VF page that I am making that I was hoping someone might have some ideas on how to solve. Basically, I have some fields that are conditionally rendered as either input or output fields. These fields are contained within pageBlockSectionItem tags (so that I could bring in the help text), within pageBlockSection tags, inside column tags, in a pageBlockTable. My issue is that the outputFields seem to always display center justified but the input fields display more like they are left justified which I prefer.
I have tried playing with column widths, adding css either inline or in style tags, etc. but cannot seem to get these to behave the way I would like. It should also be mentioned that I did have showheader="false" sidebar="false" in the page tag previously but that made the help bubbles go away so that is not an option. Any thoughts would be greatly appreciated. Page code and picture examples are below. Let me know if you would like me to post up the controller code as well but I thought it was most likely unnecessary.
<apex:page standardController="Opportunity" extensions="OppCompetitorInsertController" > <apex:form > <!-- <apex:actionFunction action="{!methodOne}" name="methodOneInJavascript" > <apex:param name="firstParam" assignTo="{!testId}" value="" /> </apex:actionFunction> --> <style> .outputAlign { text-align:left; align:left; } </style> <apex:pageBlock title="Add Competitors"> <apex:pageMessages /> <apex:pageBlockTable value="{!wrappers}" var="wrapper" id="wtable" width="95%" columnClasses="outputAlign"> <apex:column width="23px" style="background-color: {!wrapper.backgroundColor};" > <apex:pageBlockSection > <apex:pageBlockSectionItem helpText="{!$ObjectType.Opportunity_Competitor__c.Fields.Primary__c.inlineHelpText}"> <apex:outputLabel value="Primary: " for="primaryFieldId" style="font-weight: bold"/> <apex:inputField value="{!wrapper.oppComp.Primary__c}" id="primaryFieldId" rendered="{!wrapper.editable}"/> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem helpText="{!$ObjectType.Opportunity_Competitor__c.Fields.Primary__c.inlineHelpText}"> <apex:outputField value="{!wrapper.oppComp.Primary__c}" id="primaryFieldId" rendered="{!NOT(wrapper.editable)}" style="padding-right: 100px;" styleClass="outputAlign"/> </apex:pageBlockSectionItem> </apex:pageBlockSection> </apex:column> <apex:column width="180px" style="background-color: {!wrapper.backgroundColor};"> <apex:pageBlockSection > <apex:pageBlockSectionItem helpText="{!$ObjectType.Opportunity_Competitor__c.Fields.Competitor__c.inlineHelpText}"> <apex:outputLabel value="Competitor: " for="competitorFieldId" style="font-weight: bold"/> <apex:inputField value="{!wrapper.oppComp.Competitor__c}" style="height:20px; width:100px" id="competitorFieldId" rendered="{!wrapper.editable}"/> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem helpText="{!$ObjectType.Opportunity_Competitor__c.Fields.Competitor__c.inlineHelpText}"> <apex:outputField value="{!wrapper.oppComp.Competitor__c}" style="height:20px; width:50px; align:left" id="competitorFieldId" rendered="{!NOT(wrapper.editable)}"/> </apex:pageBlockSectionItem> </apex:pageBlockSection> </apex:column> <apex:column width="43px" style="background-color: {!wrapper.backgroundColor};"> <apex:pageBlockSection > <apex:pageBlockSectionItem helpText="{!$ObjectType.Opportunity_Competitor__c.Fields.Relationship__c.inlineHelpText}"> <apex:outputLabel value="Relationship: " for="relationshipFieldId" style="font-weight: bold"/> <apex:inputField value="{!wrapper.oppComp.Relationship__c}" id="relationshipFieldId" rendered="{!wrapper.editable}"/> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem helpText="{!$ObjectType.Opportunity_Competitor__c.Fields.Relationship__c.inlineHelpText}" > <apex:outputField value="{!wrapper.oppComp.Relationship__c}" id="relationshipFieldId2" rendered="{!NOT(wrapper.editable)}"/> </apex:pageBlockSectionItem> </apex:pageBlockSection> </apex:column> <apex:column width="105px" style="background-color: {!wrapper.backgroundColor};"> <apex:pageBlockSection > <apex:pageBlockSectionItem helpText="{!$ObjectType.Opportunity_Competitor__c.Fields.Competitor_Details__c.inlineHelpText}"> <apex:outputLabel value="Competitor Details: " for="compDetailsFieldId" style="font-weight: bold"/> <apex:inputField value="{!wrapper.oppComp.Competitor_Details__c}" style="height:20px; width:300px" id="compDetailsFieldId" rendered="{!wrapper.editable}"/> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem helpText="{!$ObjectType.Opportunity_Competitor__c.Fields.Competitor_Details__c.inlineHelpText}"> <apex:outputField value="{!wrapper.oppComp.Competitor_Details__c}" style="height:20px; width:300px" id="compDetailsFieldId2" rendered="{!NOT(wrapper.editable)}"/> </apex:pageBlockSectionItem> </apex:pageBlockSection> </apex:column> <apex:column width="14px" style="background-color: {!wrapper.backgroundColor};"> <apex:pageBlockSection > <apex:pageBlockSectionItem > <apex:commandButton value="Edit" action="{!edit}" immediate="true" rerender="wtable" style="width:50px" > <apex:param name="toDelIdent" value="{!wrapper.ident}" assignTo="{!toEditIdent}"/> </apex:commandButton> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > <apex:commandButton value="Cancel" action="{!cancel}" immediate="true" rerender="wtable" style="width:50px" > <apex:param name="toCancelIdent" value="{!wrapper.ident}" assignTo="{!toCancelIdent}"/> </apex:commandButton> </apex:pageBlockSectionItem> </apex:pageBlockSection> </apex:column> <apex:column width="14px" style="background-color: {!wrapper.backgroundColor};"> <apex:pageBlockSection > <apex:pageBlockSectionItem > <apex:commandButton value="Delete" action="{!delWrapper}" immediate="true" rerender="wtable" style="width:50px"> <apex:param name="toDelIdent" value="{!wrapper.ident}" assignTo="{!toDelIdent}"/> <apex:param name="beingDelTrue" value="true" assignTo="{!wrapper.beingDeleted}"/> </apex:commandButton> </apex:pageBlockSectionItem> </apex:pageBlockSection> </apex:column> </apex:pageBlockTable> <apex:commandButton value="Add Row" action="{!addRows}" rerender="wtable"> <apex:param name="addCount" value="1" assignTo="{!addCount}"/> </apex:commandButton> <apex:commandButton value="Save All" action="{!save}" rerender="wtable"> </apex:commandButton> </apex:pageBlock> </apex:form> </apex:page>
- Chris Lites
- December 29, 2015
- Like
- 0
Get around master-detail validation in visualforce page
Hi,
I am running in to an issue that I have not been able to solve and I was hoping that someone might have an idea of how to fix it. I have a visualforce page that allows me to add and remove child junction objects called Opportunity Competotors to the parent Opportunity object. the Opportunity Competitor object joins the Opportunity and Account objects with Account being in a master-detail relationship and Opportunity is a parent object in a lookup relationship. So because of this the Account field is required.
I am able to add new Opportunity Competitor junction objects to the page by adding a new wrapper object, however, it will not let me delete the unsaved junction object without first entering in an Account that meets the filter criteria. This is annoying from an end user perspective because there is no reason that they should need to enter information for something that they are just trying to delete.
My issue seems to be that I cannot even get to the delete method (delWrapper) before the error is thrown. It appears to be entering the getter method for the wrapper class at the very top of the controller and then entering the getter method for the Opportunity Competitor in the Wrapper class. at this point, I have not been able to pass which action is being taken as the param in the delete command button gets passed after the rerender I believe and I am not even able to reach the delete or save methods before this validation that there is an Account is performed.
Any ideas about how to get around this would be greatly appreciated.
this code was based on an idea in Bob Buzzard's blog located here:
http://bobbuzzard.blogspot.co.uk/2011/07/managing-list-of-new-records-in.html
controller:
I am running in to an issue that I have not been able to solve and I was hoping that someone might have an idea of how to fix it. I have a visualforce page that allows me to add and remove child junction objects called Opportunity Competotors to the parent Opportunity object. the Opportunity Competitor object joins the Opportunity and Account objects with Account being in a master-detail relationship and Opportunity is a parent object in a lookup relationship. So because of this the Account field is required.
I am able to add new Opportunity Competitor junction objects to the page by adding a new wrapper object, however, it will not let me delete the unsaved junction object without first entering in an Account that meets the filter criteria. This is annoying from an end user perspective because there is no reason that they should need to enter information for something that they are just trying to delete.
My issue seems to be that I cannot even get to the delete method (delWrapper) before the error is thrown. It appears to be entering the getter method for the wrapper class at the very top of the controller and then entering the getter method for the Opportunity Competitor in the Wrapper class. at this point, I have not been able to pass which action is being taken as the param in the delete command button gets passed after the rerender I believe and I am not even able to reach the delete or save methods before this validation that there is an Account is performed.
Any ideas about how to get around this would be greatly appreciated.
this code was based on an idea in Bob Buzzard's blog located here:
http://bobbuzzard.blogspot.co.uk/2011/07/managing-list-of-new-records-in.html
controller:
public with sharing class OppCompetitorInsertController { public List<OppCompetitorWrapper> wrappers {get; set;}/* {if((!OppCompetitorWrapper.isSaved) && (OppCompetitorWrapper.oppComp.Competitor__c != null)) { } } set;}*/ public Integer testId {get; set;} public static Integer toDelIdent {get; set;} public static Integer addCount {get; set;} private Integer nextIdent=0; private ApexPages.StandardController controller; public Opportunity oppRecord {get; set;} public OppCompetitorInsertController(ApexPages.StandardController controller) { system.debug('test1'); this.controller = controller; if (!Test.isRunningTest()) { controller.addFields(new List<String>{'Id', 'Name'}); } oppRecord = (Opportunity)controller.getRecord(); system.debug(oppRecord); List<Opportunity_Competitor__c> currentCompetitorList = new List<Opportunity_Competitor__c>{}; currentCompetitorList = [select Name, Id, Competitor__c, Competitor_Details__c, Lost_To__c, Opportunity__c, Primary__c, Replaced__c, Relationship__c, Opportunity__r.Id, Opportunity__r.Competitor_Replaced__c, Opportunity__r.Competitor_Lost_To__c, Opportunity__r.Competitor_Complemented__c, Opportunity__r.Primary_Competitor__c from Opportunity_Competitor__c where Opportunity_Competitor__c.Opportunity__c =: oppRecord.Id]; wrappers = new List<OppCompetitorWrapper>(); for(Opportunity_Competitor__c oppcomp : currentCompetitorList) { system.debug(oppcomp.Id); wrappers.add(new OppCompetitorWrapper(nextIdent++, oppcomp, true, false)); } } public void delWrapper() { system.debug('checkpoint1'); Integer toDelPos=-1; for (Integer idx=0; idx<wrappers.size(); idx++) { if (wrappers[idx].ident==toDelIdent) { toDelPos=idx; } } system.debug('checkpoint2'); system.debug(toDelPos); if (-1!=toDelPos) { if((wrappers.get(toDelPos).oppComp.Relationship__c == 'Replaced') && (wrappers.get(toDelPos).oppComp.Primary__c)) { oppRecord.Competitor_Replaced__c = null; } if((wrappers.get(toDelPos).oppComp.Relationship__c == 'Lost To') && (wrappers.get(toDelPos).oppComp.Primary__c)) { oppRecord.Competitor_Lost_To__c = null; } if((wrappers.get(toDelPos).oppComp.Relationship__c == 'Complemented') && (wrappers.get(toDelPos).oppComp.Primary__c)) { oppRecord.Competitor_Complemented__c = null; } if((wrappers.get(toDelPos).oppComp.Relationship__c == null) && (wrappers.get(toDelPos).oppComp.Primary__c)) { oppRecord.Primary_Competitor__c = null; } if(wrappers.get(toDelPos).isSaved) { try { delete wrappers.get(toDelPos).oppComp; update oppRecord; } catch (DmlException e) { system.debug(LoggingLevel.ERROR, 'There was an error: ' + e.getMessage()); } } system.debug('checkpoint3'); wrappers.remove(toDelPos); } } public void addRows() { for (Integer idx=0; idx<addCount; idx++) { wrappers.add(new OppCompetitorWrapper(nextIdent++, oppRecord, false, true)); } } public void /*PageReference*/ save() { List<Opportunity_Competitor__c> oppCompsToUpsert = new List<Opportunity_Competitor__c>(); List<Opportunity_Competitor__c> oppCompsReplaced = new List<Opportunity_Competitor__c>(); List<Opportunity_Competitor__c> oppCompsLostTo = new List<Opportunity_Competitor__c>(); List<Opportunity_Competitor__c> oppCompsComplemented = new List<Opportunity_Competitor__c>(); List<Opportunity_Competitor__c> oppCompsPrimary = new List<Opportunity_Competitor__c>(); list<OppCompetitorWrapper> ocwsChangedIsSaved = new list<OppCompetitorWrapper>{}; Integer errorCount = 0; for (OppCompetitorWrapper wrap : wrappers) { Integer ocCount = 0; oppCompsToUpsert.add(wrap.oppComp); if(!wrap.isSaved) { wrap.isNew = false; wrap.isSaved = true; ocwsChangedIsSaved.add(wrap); } if((wrap.oppComp.Relationship__c == 'Replaced') && (wrap.oppComp.Primary__c)) { oppCompsReplaced.add(wrap.oppComp); } for(Opportunity_Competitor__c ocr : oppCompsReplaced) { if(ocCount > 0) { ocr.Relationship__c.addError('You can only have one primary competitor that is replaced.'); errorCount++; } ocCount++; } ocCount = 0; if((wrap.oppComp.Relationship__c == 'Lost To') && (wrap.oppComp.Primary__c)) { oppCompsLostTo.add(wrap.oppComp); } for(Opportunity_Competitor__c oclt : oppCompsLostTo) { if(ocCount > 0) { oclt.Relationship__c.addError('You can only have one primary competitor that is lost to.'); errorCount++; } ocCount++; } ocCount = 0; if((wrap.oppComp.Relationship__c == 'Complemented') && (wrap.oppComp.Primary__c)) { oppCompsComplemented.add(wrap.oppComp); } for(Opportunity_Competitor__c occ : oppCompsComplemented) { if(ocCount > 0) { occ.Relationship__c.addError('You can only have one primary competitor that is complemented.'); errorCount++; } ocCount++; } ocCount = 0; if((wrap.oppComp.Primary__c) && (wrap.oppComp.Relationship__c == null)) { oppCompsPrimary.add(wrap.oppComp); } for(Opportunity_Competitor__c ocp : oppCompsPrimary) { if(ocCount > 0) { ocp.Primary__c.addError('You can only have one competitor that is primary when a Relationship value has not been selected.'); errorCount++; } ocCount++; } ocCount = 0; } if(errorCount < 1) { if(!oppCompsReplaced.IsEmpty()) { oppRecord.Competitor_Replaced__c = oppCompsReplaced.get(0).Competitor__c; } else { oppRecord.Competitor_Replaced__c = null; } if(!oppCompsLostTo.IsEmpty()) { oppRecord.Competitor_Lost_To__c = oppCompsLostTo.get(0).Competitor__c; } else { oppRecord.Competitor_Lost_To__c = null; } if(!oppCompsComplemented.IsEmpty()) { oppRecord.Competitor_Complemented__c = oppCompsLostTo.get(0).Competitor__c; } else { oppRecord.Competitor_Complemented__c = null; } if(!oppCompsPrimary.IsEmpty()) { oppRecord.Primary_Competitor__c = oppCompsPrimary.get(0).Competitor__c; } else { oppRecord.Primary_Competitor__c = null; } try { update oppRecord; upsert oppCompsToUpsert; } catch (DmlException e) { system.debug(LoggingLevel.ERROR, 'There was an error: ' + e.getMessage()); } } else { for(OppCompetitorWrapper ocw : ocwsChangedIsSaved) { ocw.isSaved = false; } ocwsChangedIsSaved.clear(); } //return new PageReference('/' + Schema.getGlobalDescribe().get('Opportunity').getDescribe().getKeyPrefix() + '/o'); //return new PageReference('/' + oppRecord.Id); } public void methodOne() { system.debug('entering method 1'); OppCompetitorWrapper selectedLine; for(integer i = 0; i < wrappers.size(); i++) { if(wrappers[i].ident == testId) { wrappers[i].beingDeleted = true; } system.debug(wrappers[i]); system.debug(wrappers[i].beingDeleted); } } public class OppCompetitorWrapper { public Integer ident {get; private set;} public boolean isSaved {get; private set;} public boolean isNew {get; private set;} public boolean beingDeleted {get; set;} public String tooManyReplacedError {get; set;} public Opportunity_Competitor__c oppComp { get{ system.debug('oppComp.Id = ' + oppComp.Id); system.debug('isNew = ' + isNew); system.debug('isSaved = ' + isSaved); if((oppComp.Id == null) && (isSaved == false) && (isNew == false)) { oppComp.Competitor__c = '0018000000t9eJq'; return oppComp; } else if((oppComp.Id == null) && (isSaved == false) && (isNew == true)) { system.debug('oppComp = ' + oppComp); Opportunity_Competitor__c oppComp2 = new Opportunity_Competitor__c(Opportunity__c = oppComp.Opportunity__c); system.debug('oppComp2 = ' + oppComp2); return oppComp2; } else { return oppComp; } } set; } public String backgroundColor { get{ system.debug('oppComp.Id = ' + oppComp.Id); system.debug('isSaved = ' + isSaved); if(isSaved == true) return '#eeeeef'; else return '#FFF'; } set; } set<Id> idsToCheck = new set<Id>{}; public OppCompetitorWrapper(Integer inIdent, Opportunity opp, boolean isRecordSaved, boolean isRecordNew) { isNew = isRecordNew; isSaved = isRecordSaved; ident=inIdent; oppComp = new Opportunity_Competitor__c(Opportunity__c = opp.Id); tooManyReplacedError =''; } public OppCompetitorWrapper(Integer inIdent, Opportunity_Competitor__c currentoppcomp, boolean isRecordSaved, boolean isRecordNew) { isNew = isRecordNew; ident=inIdent; isSaved = isRecordSaved; oppComp = currentoppcomp; tooManyReplacedError =''; } } }page:
<apex:page standardController="Opportunity" extensions="OppCompetitorInsertController"> <apex:form > <apex:actionFunction action="{!methodOne}" name="methodOneInJavascript" > <apex:param name="firstParam" assignTo="{!testId}" value="" /> </apex:actionFunction> <apex:pageBlock title="Add Competitors"> <apex:pageMessages /> <apex:pageBlockTable value="{!wrappers}" var="wrapper" id="wtable" width="95%"> <apex:column width="23px" style="background-color: {!wrapper.backgroundColor};"> <apex:outputLabel value="Primary: " for="primaryFieldId" style="font-weight: bold; padding-right:7px"/><br /> <apex:inputField value="{!wrapper.oppComp.Primary__c}" id="primaryFieldId"/> </apex:column> <apex:column width="440px" style="background-color: {!wrapper.backgroundColor};"> <apex:outputLabel value="Competitor: " for="competitorFieldId" style="font-weight: bold"/><br /> <apex:inputField value="{!wrapper.oppComp.Competitor__c}" style="height:20px; width:400px" id="competitorFieldId"/> </apex:column> <apex:column width="43px" style="background-color: {!wrapper.backgroundColor};"> <apex:outputLabel value="Relationship: " for="relationshipFieldId" style="font-weight: bold; padding-right:7px"/><br /> <apex:inputField value="{!wrapper.oppComp.Relationship__c}" id="relationshipFieldId"/> </apex:column> <apex:column width="105px" style="background-color: {!wrapper.backgroundColor};"> <apex:outputLabel value="Competitor Details: " for="compDetailsFieldId" style="font-weight: bold"/><br /> <apex:inputField value="{!wrapper.oppComp.Competitor_Details__c}" style="height:20px; width:300px" id="compDetailsFieldId"/> </apex:column> <apex:column width="14px" style="background-color: {!wrapper.backgroundColor};"> <apex:commandButton value="Delete" action="{!delWrapper}" rerender="wtable" style="width:40px"> <apex:param name="toDelIdent" value="{!wrapper.ident}" assignTo="{!toDelIdent}"/> <apex:param name="beingDelTrue" value="true" assignTo="{!wrapper.beingDeleted}"/> </apex:commandButton> </apex:column> <!-- <apex:column width="23px" style="background-color: {!wrapper.backgroundColor};"> <div> <apex:outputPanel onclick="methodOneInJavascript('{!wrapper.ident}')" > test </apex:outputPanel> </div> </apex:column> --> </apex:pageBlockTable> <apex:commandButton value="Add Row" action="{!addRows}" rerender="wtable"> <apex:param name="addCount" value="1" assignTo="{!addCount}"/> </apex:commandButton> <apex:commandButton value="Save All" action="{!save}" rerender="wtable"> </apex:commandButton> </apex:pageBlock> </apex:form> </apex:page>
- Chris Lites
- December 04, 2014
- Like
- 0
Get multiselect chosen values before database commit.
Hi,
I am running in to an issue that I was hoping to get some advice on. I am building a visualforce page that exposes some multiselect picklists on a custom object. I would like to be able to find what the currently selected values of those picklists are (the ones on the right in the "chosen" area) and do a soql query based on those values. I would like to be able to do this with the current page state prior to actually commiting those values to the database. in fact, I would ideally like to do the query and then reset the values so none are chosen and none get committed to the database.
I have tried accessing the field values using the following:
Schema.DescribeFieldResult fieldResult = Custom_Object__c.Picklist__c.getDescribe();
List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
and that gives me a list of all the possible picklist values and if they are default and if they are active, but the active means "if this item must be displayed in the drop-down list for the picklist field in the user interface" so that is not helpful. I need a "selected" attribute or something of that nature.
Anyway, if anyone has any good ideas on how to access this or another way to accomplish this it would be appreciated.
Thanks,
Chris
I am running in to an issue that I was hoping to get some advice on. I am building a visualforce page that exposes some multiselect picklists on a custom object. I would like to be able to find what the currently selected values of those picklists are (the ones on the right in the "chosen" area) and do a soql query based on those values. I would like to be able to do this with the current page state prior to actually commiting those values to the database. in fact, I would ideally like to do the query and then reset the values so none are chosen and none get committed to the database.
I have tried accessing the field values using the following:
Schema.DescribeFieldResult fieldResult = Custom_Object__c.Picklist__c.getDescribe();
List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
and that gives me a list of all the possible picklist values and if they are default and if they are active, but the active means "if this item must be displayed in the drop-down list for the picklist field in the user interface" so that is not helpful. I need a "selected" attribute or something of that nature.
Anyway, if anyone has any good ideas on how to access this or another way to accomplish this it would be appreciated.
Thanks,
Chris
- Chris Lites
- July 15, 2014
- Like
- 0
REST Post from SFDC using SSL certs provided by destination vendor
Hi folks,
I was having a bit of difficulty figuring out how to implement an integration and I was hoping someone might have some insight. What I need to to is make an HTTPS callout from SFDC to another system where there system is expecting an incoming XML file where the connection is secured with SSL and they provide SSL files. I am unaware of how to use their SSL files within SFDC and my APEX code. I have seen plenty of discussions of how to generate SSL certificates in SFDC but I assume that I should just be using theirs and I am not sure how. I have also seen many examples going from an external source and posting in to SFDC but not much the other way around. I have also seen that this may be how to use it in APEX once it is generated but that same material only explains how to create it in SFDC, not how to use a provided certificate.
below is my current code which is hitting their server but returning an unauthorized 401 error. Sensitive or unnecessary parts have been changed/removed.
Please find the following information related to our SSL certificates and authentication:
______________________________________________________________________________________________
Attached are the certificates:
STAR.MANAGEMENTDYNAMICS.COM.zip: This has a wild card certificate; like: *.managementdynamics.com. It works for both eoduat (test) and eod (production).
root-intermediate-certificates.zip: This has three certificate files; one root and two intermediate
Notes:
Our certificates are issued by:
Network Solutions CA company
Network Solutions CA company gets their certificate signed from UTN-USERFIRST CA company
UTN-USERFIRST CA company gets their certificate signed from AddTrustExternal CA (this is root CA)
In order to make a secured connection, your certificate store must have intermediate & root certificates. If you already have these, there is no need to import them.
The Actual SSL Certificates in STAR.MANAGEMENTDYNAMICS.COM.zip are valid until 01/16/2018.
Our servers do not support non-SSL connections. While sending the inbound XML request, you have to set the Authorization HTTP header in the following format in order to successfully logon (Reference Section 3.1.3, page 28 of Integration guide):
Basic<Space><Base 64 Encode(UserName:Password)>
Be sure to post your files to the correct URL based on whether you want to send to the test or the production environment, and be sure you use the correct UserName and Password for each environment.
______________________________________________________________________________________________
finally, a slightly off topic question, I have set them up as a remote site but I just used the base URL of their company, I did not include the application context after the .com that I use for the endpoint connection. Is this correct or do I put the whole endpoint connection for the remote site? Anyway, any ideas or suggestions would be greatly appreciated. Thanks!
I was having a bit of difficulty figuring out how to implement an integration and I was hoping someone might have some insight. What I need to to is make an HTTPS callout from SFDC to another system where there system is expecting an incoming XML file where the connection is secured with SSL and they provide SSL files. I am unaware of how to use their SSL files within SFDC and my APEX code. I have seen plenty of discussions of how to generate SSL certificates in SFDC but I assume that I should just be using theirs and I am not sure how. I have also seen many examples going from an external source and posting in to SFDC but not much the other way around. I have also seen that this may be how to use it in APEX once it is generated but that same material only explains how to create it in SFDC, not how to use a provided certificate.
req.setClientCertificateName('DocSampleCert');
below is my current code which is hitting their server but returning an unauthorized 401 error. Sensitive or unnecessary parts have been changed/removed.
@future (callout=true) public static void basicAuthCallout(String name, Id id){ system.debug('point 3'); String xmlToEscape = '<?xml version="1.0" encoding="UTF-8"?>' + '<PartnerRecord version="2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="PartnerXml.xsd">' + '<PartnerId>' + id + '</PartnerId>' + '<OrgCode></OrgCode>' + '<CompanyCode></CompanyCode>' + '<Name>' + name + '</Name>' + // unnecessary parts of XML string removed '</PartnerRecord>'; String xmlToSend = xmlToEscape.escapeXml(); HttpRequest req = new HttpRequest(); req.setEndpoint('https://example integration endpoint URL'); req.setMethod('POST'); // Specify the required user name and password to access the endpoint // As well as the header and header information String username = 'exampleUserName'; String password = 'examplePassword'; Blob headerValue = Blob.valueOf(username + ':' + password); String authorizationHeader = 'BASIC ' + EncodingUtil.base64Encode(headerValue); req.setHeader('Authorization', authorizationHeader); req.setBody(xmlToSend); // Create a new http object to send the request object // A response object is generated as a result of the request Http http = new Http(); HttpResponse res = new HttpResponse(); try { res = http.send(req); } catch(System.CalloutException e) { System.debug('Callout error: '+ e); System.debug(res.toString()); } //HTTPResponse res = http.send(req); System.debug(res.getBody()); }and here is the info that I got from the 3rd party as well as 2 zip files:
Please find the following information related to our SSL certificates and authentication:
______________________________________________________________________________________________
Attached are the certificates:
STAR.MANAGEMENTDYNAMICS.COM.zip: This has a wild card certificate; like: *.managementdynamics.com. It works for both eoduat (test) and eod (production).
root-intermediate-certificates.zip: This has three certificate files; one root and two intermediate
Notes:
Our certificates are issued by:
Network Solutions CA company
Network Solutions CA company gets their certificate signed from UTN-USERFIRST CA company
UTN-USERFIRST CA company gets their certificate signed from AddTrustExternal CA (this is root CA)
In order to make a secured connection, your certificate store must have intermediate & root certificates. If you already have these, there is no need to import them.
The Actual SSL Certificates in STAR.MANAGEMENTDYNAMICS.COM.zip are valid until 01/16/2018.
Our servers do not support non-SSL connections. While sending the inbound XML request, you have to set the Authorization HTTP header in the following format in order to successfully logon (Reference Section 3.1.3, page 28 of Integration guide):
Basic<Space><Base 64 Encode(UserName:Password)>
Be sure to post your files to the correct URL based on whether you want to send to the test or the production environment, and be sure you use the correct UserName and Password for each environment.
______________________________________________________________________________________________
finally, a slightly off topic question, I have set them up as a remote site but I just used the base URL of their company, I did not include the application context after the .com that I use for the endpoint connection. Is this correct or do I put the whole endpoint connection for the remote site? Anyway, any ideas or suggestions would be greatly appreciated. Thanks!
- Chris Lites
- July 27, 2015
- Like
- 0
REST Post from SFDC using 3rd party provided SSL
Hi folks,
I was having a bit of difficulty figuring out how to implement an integration and I was hoping someone might have some insight. What I need to to is make an HTTPS callout from SFDC to another system where there system is expecting an incoming XML file where the connection is secured with SSL and they provide SSL files. I am unaware of how to use their SSL files within SFDC and my APEX code. I have seen plenty of discussions of how to generate SSL certificates in SFDC but I assume that I should just be using theirs and I am not sure how. I have also seen many examples going from an external source and posting in to SFDC but not much the other way around. I have also seen that this may be how to use it in APEX once it is generated but that same material only explains how to create it in SFDC, not how to use a provided certificate.
below is my current code which is hitting their server but returning an unauthorized 401 error. Sensitive or unnecessary parts have been changed/removed.
and here is the info that I got from the 3rd party as well as 2 zip files:
Please find the following information related to our SSL certificates and authentication:
______________________________________________________________________________________________
Attached are the certificates:
STAR.MANAGEMENTDYNAMICS.COM.zip: This has a wild card certificate; like: *.managementdynamics.com. It works for both eoduat (test) and eod (production).
root-intermediate-certificates.zip: This has three certificate files; one root and two intermediate
Notes:
Our certificates are issued by:
Network Solutions CA company
Network Solutions CA company gets their certificate signed from UTN-USERFIRST CA company
UTN-USERFIRST CA company gets their certificate signed from AddTrustExternal CA (this is root CA)
In order to make a secured connection, your certificate store must have intermediate & root certificates. If you already have these, there is no need to import them.
The Actual SSL Certificates in STAR.MANAGEMENTDYNAMICS.COM.zip are valid until 01/16/2018.
Our servers do not support non-SSL connections. While sending the inbound XML request, you have to set the Authorization HTTP header in the following format in order to successfully logon (Reference Section 3.1.3, page 28 of Integration guide):
Basic<Space><Base 64 Encode(UserName:Password)>
Be sure to post your files to the correct URL based on whether you want to send to the test or the production environment, and be sure you use the correct UserName and Password for each environment.
______________________________________________________________________________________________
finally, a slightly off topic question, I have set them up as a remote site but I just used the base URL of their company, I did not include the application context after the .com that I use for the endpoint connection. Is this correct or do I put the whole endpoint connection for the remote site? Anyway, any ideas or suggestions would be greatly appreciated. Thanks!
I was having a bit of difficulty figuring out how to implement an integration and I was hoping someone might have some insight. What I need to to is make an HTTPS callout from SFDC to another system where there system is expecting an incoming XML file where the connection is secured with SSL and they provide SSL files. I am unaware of how to use their SSL files within SFDC and my APEX code. I have seen plenty of discussions of how to generate SSL certificates in SFDC but I assume that I should just be using theirs and I am not sure how. I have also seen many examples going from an external source and posting in to SFDC but not much the other way around. I have also seen that this may be how to use it in APEX once it is generated but that same material only explains how to create it in SFDC, not how to use a provided certificate.
req.setClientCertificateName('DocSampleCert');
below is my current code which is hitting their server but returning an unauthorized 401 error. Sensitive or unnecessary parts have been changed/removed.
@future (callout=true) public static void basicAuthCallout(String name, Id id){ system.debug('point 3'); String xmlToEscape = '<?xml version="1.0" encoding="UTF-8"?>' + '<PartnerRecord version="2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="PartnerXml.xsd">' + '<PartnerId>' + id + '</PartnerId>' + '<OrgCode></OrgCode>' + '<CompanyCode></CompanyCode>' + '<Name>' + name + '</Name>' + // unnecessary parts of XML string removed '</PartnerRecord>'; String xmlToSend = xmlToEscape.escapeXml(); HttpRequest req = new HttpRequest(); req.setEndpoint('https://example integration endpoint URL'); req.setMethod('POST'); // Specify the required user name and password to access the endpoint // As well as the header and header information String username = 'exampleUserName'; String password = 'examplePassword'; Blob headerValue = Blob.valueOf(username + ':' + password); String authorizationHeader = 'BASIC ' + EncodingUtil.base64Encode(headerValue); req.setHeader('Authorization', authorizationHeader); req.setBody(xmlToSend); // Create a new http object to send the request object // A response object is generated as a result of the request Http http = new Http(); HttpResponse res = new HttpResponse(); try { res = http.send(req); } catch(System.CalloutException e) { System.debug('Callout error: '+ e); System.debug(res.toString()); } //HTTPResponse res = http.send(req); System.debug(res.getBody()); }
and here is the info that I got from the 3rd party as well as 2 zip files:
Please find the following information related to our SSL certificates and authentication:
______________________________________________________________________________________________
Attached are the certificates:
STAR.MANAGEMENTDYNAMICS.COM.zip: This has a wild card certificate; like: *.managementdynamics.com. It works for both eoduat (test) and eod (production).
root-intermediate-certificates.zip: This has three certificate files; one root and two intermediate
Notes:
Our certificates are issued by:
Network Solutions CA company
Network Solutions CA company gets their certificate signed from UTN-USERFIRST CA company
UTN-USERFIRST CA company gets their certificate signed from AddTrustExternal CA (this is root CA)
In order to make a secured connection, your certificate store must have intermediate & root certificates. If you already have these, there is no need to import them.
The Actual SSL Certificates in STAR.MANAGEMENTDYNAMICS.COM.zip are valid until 01/16/2018.
Our servers do not support non-SSL connections. While sending the inbound XML request, you have to set the Authorization HTTP header in the following format in order to successfully logon (Reference Section 3.1.3, page 28 of Integration guide):
Basic<Space><Base 64 Encode(UserName:Password)>
Be sure to post your files to the correct URL based on whether you want to send to the test or the production environment, and be sure you use the correct UserName and Password for each environment.
______________________________________________________________________________________________
finally, a slightly off topic question, I have set them up as a remote site but I just used the base URL of their company, I did not include the application context after the .com that I use for the endpoint connection. Is this correct or do I put the whole endpoint connection for the remote site? Anyway, any ideas or suggestions would be greatly appreciated. Thanks!
- Chris Lites
- July 24, 2015
- Like
- 0
inputField and outputField alignment help needed
Hi,
I am having a bit of an issue on an inline VF page that I am making that I was hoping someone might have some ideas on how to solve. Basically, I have some fields that are conditionally rendered as either input or output fields. These fields are contained within pageBlockSectionItem tags (so that I could bring in the help text), within pageBlockSection tags, inside column tags, in a pageBlockTable. My issue is that the outputFields seem to always display center justified but the input fields display more like they are left justified which I prefer.
I have tried playing with column widths, adding css either inline or in style tags, etc. but cannot seem to get these to behave the way I would like. It should also be mentioned that I did have showheader="false" sidebar="false" in the page tag previously but that made the help bubbles go away so that is not an option. Any thoughts would be greatly appreciated. Page code and picture examples are below. Let me know if you would like me to post up the controller code as well but I thought it was most likely unnecessary.
I am having a bit of an issue on an inline VF page that I am making that I was hoping someone might have some ideas on how to solve. Basically, I have some fields that are conditionally rendered as either input or output fields. These fields are contained within pageBlockSectionItem tags (so that I could bring in the help text), within pageBlockSection tags, inside column tags, in a pageBlockTable. My issue is that the outputFields seem to always display center justified but the input fields display more like they are left justified which I prefer.
I have tried playing with column widths, adding css either inline or in style tags, etc. but cannot seem to get these to behave the way I would like. It should also be mentioned that I did have showheader="false" sidebar="false" in the page tag previously but that made the help bubbles go away so that is not an option. Any thoughts would be greatly appreciated. Page code and picture examples are below. Let me know if you would like me to post up the controller code as well but I thought it was most likely unnecessary.
<apex:page standardController="Opportunity" extensions="OppCompetitorInsertController" > <apex:form > <!-- <apex:actionFunction action="{!methodOne}" name="methodOneInJavascript" > <apex:param name="firstParam" assignTo="{!testId}" value="" /> </apex:actionFunction> --> <style> .outputAlign { text-align:left; align:left; } </style> <apex:pageBlock title="Add Competitors"> <apex:pageMessages /> <apex:pageBlockTable value="{!wrappers}" var="wrapper" id="wtable" width="95%" columnClasses="outputAlign"> <apex:column width="23px" style="background-color: {!wrapper.backgroundColor};" > <apex:pageBlockSection > <apex:pageBlockSectionItem helpText="{!$ObjectType.Opportunity_Competitor__c.Fields.Primary__c.inlineHelpText}"> <apex:outputLabel value="Primary: " for="primaryFieldId" style="font-weight: bold"/> <apex:inputField value="{!wrapper.oppComp.Primary__c}" id="primaryFieldId" rendered="{!wrapper.editable}"/> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem helpText="{!$ObjectType.Opportunity_Competitor__c.Fields.Primary__c.inlineHelpText}"> <apex:outputField value="{!wrapper.oppComp.Primary__c}" id="primaryFieldId" rendered="{!NOT(wrapper.editable)}" style="padding-right: 100px;" styleClass="outputAlign"/> </apex:pageBlockSectionItem> </apex:pageBlockSection> </apex:column> <apex:column width="180px" style="background-color: {!wrapper.backgroundColor};"> <apex:pageBlockSection > <apex:pageBlockSectionItem helpText="{!$ObjectType.Opportunity_Competitor__c.Fields.Competitor__c.inlineHelpText}"> <apex:outputLabel value="Competitor: " for="competitorFieldId" style="font-weight: bold"/> <apex:inputField value="{!wrapper.oppComp.Competitor__c}" style="height:20px; width:100px" id="competitorFieldId" rendered="{!wrapper.editable}"/> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem helpText="{!$ObjectType.Opportunity_Competitor__c.Fields.Competitor__c.inlineHelpText}"> <apex:outputField value="{!wrapper.oppComp.Competitor__c}" style="height:20px; width:50px; align:left" id="competitorFieldId" rendered="{!NOT(wrapper.editable)}"/> </apex:pageBlockSectionItem> </apex:pageBlockSection> </apex:column> <apex:column width="43px" style="background-color: {!wrapper.backgroundColor};"> <apex:pageBlockSection > <apex:pageBlockSectionItem helpText="{!$ObjectType.Opportunity_Competitor__c.Fields.Relationship__c.inlineHelpText}"> <apex:outputLabel value="Relationship: " for="relationshipFieldId" style="font-weight: bold"/> <apex:inputField value="{!wrapper.oppComp.Relationship__c}" id="relationshipFieldId" rendered="{!wrapper.editable}"/> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem helpText="{!$ObjectType.Opportunity_Competitor__c.Fields.Relationship__c.inlineHelpText}" > <apex:outputField value="{!wrapper.oppComp.Relationship__c}" id="relationshipFieldId2" rendered="{!NOT(wrapper.editable)}"/> </apex:pageBlockSectionItem> </apex:pageBlockSection> </apex:column> <apex:column width="105px" style="background-color: {!wrapper.backgroundColor};"> <apex:pageBlockSection > <apex:pageBlockSectionItem helpText="{!$ObjectType.Opportunity_Competitor__c.Fields.Competitor_Details__c.inlineHelpText}"> <apex:outputLabel value="Competitor Details: " for="compDetailsFieldId" style="font-weight: bold"/> <apex:inputField value="{!wrapper.oppComp.Competitor_Details__c}" style="height:20px; width:300px" id="compDetailsFieldId" rendered="{!wrapper.editable}"/> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem helpText="{!$ObjectType.Opportunity_Competitor__c.Fields.Competitor_Details__c.inlineHelpText}"> <apex:outputField value="{!wrapper.oppComp.Competitor_Details__c}" style="height:20px; width:300px" id="compDetailsFieldId2" rendered="{!NOT(wrapper.editable)}"/> </apex:pageBlockSectionItem> </apex:pageBlockSection> </apex:column> <apex:column width="14px" style="background-color: {!wrapper.backgroundColor};"> <apex:pageBlockSection > <apex:pageBlockSectionItem > <apex:commandButton value="Edit" action="{!edit}" immediate="true" rerender="wtable" style="width:50px" > <apex:param name="toDelIdent" value="{!wrapper.ident}" assignTo="{!toEditIdent}"/> </apex:commandButton> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > <apex:commandButton value="Cancel" action="{!cancel}" immediate="true" rerender="wtable" style="width:50px" > <apex:param name="toCancelIdent" value="{!wrapper.ident}" assignTo="{!toCancelIdent}"/> </apex:commandButton> </apex:pageBlockSectionItem> </apex:pageBlockSection> </apex:column> <apex:column width="14px" style="background-color: {!wrapper.backgroundColor};"> <apex:pageBlockSection > <apex:pageBlockSectionItem > <apex:commandButton value="Delete" action="{!delWrapper}" immediate="true" rerender="wtable" style="width:50px"> <apex:param name="toDelIdent" value="{!wrapper.ident}" assignTo="{!toDelIdent}"/> <apex:param name="beingDelTrue" value="true" assignTo="{!wrapper.beingDeleted}"/> </apex:commandButton> </apex:pageBlockSectionItem> </apex:pageBlockSection> </apex:column> </apex:pageBlockTable> <apex:commandButton value="Add Row" action="{!addRows}" rerender="wtable"> <apex:param name="addCount" value="1" assignTo="{!addCount}"/> </apex:commandButton> <apex:commandButton value="Save All" action="{!save}" rerender="wtable"> </apex:commandButton> </apex:pageBlock> </apex:form> </apex:page>
- Chris Lites
- December 29, 2015
- Like
- 0