I am trying to record a simple Web Application which as activity of checking checkboxes as below and clicking on Submit button:
After recording the script is generated a post request as below:
web_submit_data("NonInvObjectSubmit",
"Action=URL",
"Method=POST",
"RecContentType=text/html",
"Referer=URL",
"Snapshot=t23.inf",
"Mode=HTML",
ITEMDATA,
"Name=PageStart", "Value=1", ENDITEM,
"Name=[4].bCheckBox", "Value=true", ENDITEM,
"Name=[4].Id", "Value=11701", ENDITEM,
"Name=[4].bCheckBox", "Value=false", ENDITEM,
LAST);
Observed the Value = 11701 is incrementing for each time the checkbox is used.
Replaying the same with different Index number, doesn't actually checks the checkbox.(tried providing empty Value, Random Value but nothing worked.)
Please Help. Thank you
Maybe you need to do a manual correlation. Search the Server Response and correlate the checkbox value.
Related
OK so...through a custom form, I am successfully registering attendees to Go To Webinar but am blocked if there are multiple sessions of the same webinar. Currently, I am returning scheduled sessions to populate our dropdown menu (response shown below) but am challenged with passing back sessionKey with the registration payload. Has anyone successfully done this? Help! I've also put in an inquiry with GTW so will let folks know what I hear if others are struggling with this also. Thanks!
[{
webinarKey: xxxxxxxxxxxxxxxxx,
registrantsAttended: 0,
webinarID: "xxxxxxx",
sessionKey: 666666,
startTime: "2020-05-06T19:27:54Z",
endTime: "2020-05-06T20:01:13Z"
},
{
webinarKey: xxxxxxxxxxxxxxxxx,
registrantsAttended: 0,
webinarID: "xxxxxxx",
sessionKey: 777777,
startTime: "2020-05-07T19:26:08Z",
endTime: "2020-05-07T19:26:43Z"
}]
Populate a list for the webpage visitor using Scheduled
webinars
An interested individual selects a webinar from the list
and you submit their details using Create registrant
For step 2 you should also know the following:
To use the second version of the api you must pass the header value
'Accept: application/vnd.citrix.g2wapi-v1.1+json'
instead of 'Accept: application/json'.
Leaving this header out results in the first version of the API call.
The only global custom text on Gatling report is Simulation class name. It appears in the upper right corner of the report.
How can I put some custom message (short) without changing the name of the Simulation class?
As far as I know there are 3 ways of put some custom message to Gatling report
Run description param inside gatling.conf file, it is displayed at top part of report (next to report time and duration)
gatling {
core {
runDescription = "Test description of report"
}
}
Scenario name - param of scenario in your test code, displayed on one of reports (Active Users along the Simulation)
scenario("Scenario name")
.exec(http("Action name").get("http://localhost"))
Action name - param of http in your test code, displayed on Statistic table
scenario("Scenario name")
.exec(http("Action name").get("http://localhost"))
I have my button fully working except my CRL won't populate and can't determine why.
{!REQUIRESCRIPT("/apex/dsfs__DocuSign_JavaScript")}
var RC="";var RSL="";var RSRO="";var RROS="";var CCRM="";var CCTM="";var CCNM="";var CRCL="";var OCO="";var DST="";var LA="";var CEM="";var CES="";var STB="";var SSB="";var SES="";var SEM="";var SRS="";var SCS ="";var RES="";
RC="";
RSL="2";
RSRO="";
RROS="";
CCRM="";
CRL="LoadDefaultContacts~0;Email~matt.xxxx#powerreviews.com;FirstName~Matt;LastName~xxxx;Role~Signer 2;RoutingOrder~2";
CCTM="";
CCNM="";
CRCL="";
OCO="";
DST="";
LA="0";
CEM="Hello {!dsfs__DocuSign_Envelope__c.dsfs__Contact2eSignDoc01__c}\nI am sending you this request for your electronic signature, please review and electronically sign by following the link below.\nWe highly recommend that you use the electronic signature to speed the process, however, if you do need to sign manually, please click the MORE button at the top of the Docusign screen and select the 'Sign on Paper' option - and complete the process as defined in the dialog box in Docusign. Otherwise, there may be delays in the execution of this process.\nWe appreciate your cooperation.";
CES="PowerReviews Request to eSign Contracts - {!Account.Name}";
STB="1";
SSB="1";
SES="1";
SEM="1";
SRS="1";
SCS="1";
RES="1,2,2,1,15,3";
window.location.href = "/apex/dsfs__DocuSign_CreateEnvelope?DSEID=0&SourceID={!Opportunity.Id}&RC="+RC+"&RSL="+RSL+"&RSRO="+RSRO+"&RROS="+RROS+"&CCRM="+CCRM+"&CCTM="+CCTM+"&CRCL="+CRCL+"&OCO="+OCO+"&DST="+DST+"&CCNM="+CCNM+"&LA="+LA+"&CEM="+CEM+"&CES="+CES+"&SRS="+SRS+"&STB="+STB+"&SSB="+SSB+"&SES="+SES+"&SEM="+SEM+"&SRS="+SRS+"&SCS="+SCS+"&RES="+RES;
The CRL was not populated because of two reasons. Firstly, the recipient list should be separated by a comma and not a semicolon. Secondly,CRL was not called in the page callout section.
I have modified the script to pull the custom recipient list.
{!REQUIRESCRIPT("/apex/dsfs__DocuSign_JavaScript")}
var RC="";var RSL="";var RSRO="";var RROS="";var CCRM="";var CCTM="";var CCNM="";var CRCL="";var OCO="";var DST="";var LA="";var CEM="";var CES="";var STB="";var SSB="";var SES="";var SEM="";var SRS="";var SCS ="";var RES="";
RC="";
RSL="2";
RSRO="";
RROS="";
CCRM="";
CRL="LoadDefaultContacts~0,Email~matt.xxxx#powerreviews.com;FirstName~Matt;LastName~xxxx;Role~Signer 2;RoutingOrder~2";
CCTM="";
CCNM="";
CRCL="";
OCO="";
DST="";
LA="0";
CEM="Hello {!dsfs__DocuSign_Envelope__c.dsfs__Contact2eSignDoc01__c}\nI am sending you this request for your electronic signature, please review and electronically sign by following the link below.\nWe highly recommend that you use the electronic signature to speed the process, however, if you do need to sign manually, please click the MORE button at the top of the Docusign screen and select the 'Sign on Paper' option - and complete the process as defined in the dialog box in Docusign. Otherwise, there may be delays in the execution of this process.\nWe appreciate your cooperation."; CES="PowerReviews Request to eSign Contracts - {!Account.Name}"; STB="1"; SSB="1"; SES="1"; SEM="1"; SRS="1"; SCS="1"; RES="1,2,2,1,15,3"; window.location.href = "/apex/dsfs__DocuSign_CreateEnvelope?DSEID=0&SourceID={!Opportunity.Id}&RC="+RC+"&RSL="+RSL+"&RSRO="+RSRO+"&RROS="+RROS+"&CCRM="+CCRM+"&CCTM="+CCTM+"&CRCL="+CRCL+"&OCO="+OCO+"&DST="+DST+"&CCNM="+CCNM+"&LA="+LA+"&CEM="+CEM+"&CES="+CES+"&SRS="+SRS+"&STB="+STB+"&SSB="+SSB+"&SES="+SES+"&SEM="+SEM+"&SRS="+SRS+"&SCS="+SCS+"&RES="+RES+"&CRL="+CRL;
I am developing a site in Visualforce and would like to offer user a simple form to send me feedback via email. There would be 3-4 fields like name, user's email, reason and feedback and "send" button. Clicking the send button should automatically send that message to my email address.
I do not want to store the form data in salesforce at least for now...All the stuff I found online about visualforce/apex and email is about saving that data to salesforce too.
Can I just make use of apex's email capabilities and send out email without storing that data anywhere in salesforce?
Thanks,
Calvin
It's not required to insert/update/delete any records in the database when executing an action on a VisualForce page. You can leverage the Outbound Email functionality to send out your notification. For something like this, you will probably want to familiarize yourself with the SingleEmailMessage methods.
A simple example to get you going:
public PageReference actionSend() {
String[] recipients = new String[]{'myemailaddress#somedomain.com'};
Messaging.reserveSingleEmailCapacity(recipients.size());
Messaging.SingleEmailMessage msg = new Messaging.SingleEmailMessage();
msg.setToAddresses(recipients);
msg.setSubject('Test Email Subject');
msg.setHtmlBody('Test body including HTML markup');
msg.setPlainTextBody('Test body excluding HTML markup');
msg.setSaveAsActivity(false);
msg.setUseSignature(false);
Messaging.sendEmail(new Messaging.SingleEmailMessage[] {msg}, false);
return null;
}
If you are interested in sending these outbound messages from a dedicated email address (something like noreply#somecompany.com), you can set these up through the Setup -> Administration Setup -> Email Administration -> Organization-Wide Addresses menu. Once you have created an org-wide address, grab the Id from the URL and use the setOrgWideEmailAddressId(Id) method on your instance of Messaging.SingleEmailMessage.
I am integrating our back end systems with Salesforce using the web services. I have production and stage environments running on different URLs. I need to be able to have the endpoint of the web service call be different depending on whether the code is running in the production or sandbox Salesforce instance.
How do I detect the environment.
Currently I am considering looking up a user to see if there user name ends in 'devsandbox' as I have been unable to identify a system object that I can query to get the environment.
Further clarification:
The location I need to determine this is within the Apex code that is invoked when I select a button in Salesforce. My custom controller needs to know if it running in the production or sandbox Salesforce environment.
For y'all finding this via search results, there is an important update. As Daniel Hoechst pointed out in another post, SF now directly provides sandbox vs. production information:
In Summer '14, (version 31.0), there is a new field available on the
Organization object.
select Id, IsSandbox from Organization limit 1
From the release notes under New and Change Objects:
The Organization object has the following new read-only fields.
InstanceName
IsSandbox
Based on the responses it appears that Salesforce does not have a system object that can tell me if my Apex code is running in production or a sandbox environment.
I am going to proceed based on the following assumptions:
I can read the organisation id of the current environment
The organisation id of my production system will always remain constant.
The organisation id of a sandbox will always be different to production (as they are unique)
The current organization ID can be found with System.getOrganizationId()
My solution is to have my code compare the current org id to the constant value representing production.
I'm performing necromancy here and the answer is already accepted, but maybe somebody will benefit from it...
Use one of these merge fields on your Visualforce page / S-Control:
{!$Api.Enterprise_Server_URL_180}, {!$Api.Partner_Server_URL_180}, {!$Api.Session_ID}
You can easily parse out organization ID out of them.
In Apex code: UserInfo.getOrganisationId()
I know this is an old post, but just for the sake of people looking for an updated answer as of Spring '11 release there is a new method System.URL.getSalesforceBaseUrl().toExternalForm() that returns the current url.
You can work from there to get all the info you need.
Here's the link to docs: http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_url.htm
The Login API call returns a sandbox element in the returned LoginResult structure that indicates if its a sandbox environment or not, from the WSDL.
<complexType name="LoginResult">
<sequence>
<element name="metadataServerUrl" type="xsd:string" nillable="true"/>
<element name="passwordExpired" type="xsd:boolean" />
<element name="sandbox" type="xsd:boolean"/>
<element name="serverUrl" type="xsd:string" nillable="true"/>
<element name="sessionId" type="xsd:string" nillable="true"/>
<element name="userId" type="tns:ID" nillable="true"/>
<element name="userInfo" type="tns:GetUserInfoResult" minOccurs="0"/>
</sequence>
</complexType>
Sandboxes may have a personalized url (e.g. acme.cs1.my.salesforce.com), or might be hosting a visualforce page (cs2.visual.force.com) or both (acme.cs2.visual.force.com) so I use this method:
public static Boolean isRunningInSandbox() {
String s = System.URL.getSalesforceBaseUrl().getHost();
return (Pattern.matches('(.*\\.)?cs[0-9]*(-api)?\\..*force.com',s));
}
I think the easiest way to do this would be to create a custom object in Salesforce, and then store a value indicating sandbox or production there. Your Apex code can then query that object. One suggestion would be to use Apex static constructors to load this information and cache it for the request.
Another thought I had (but hate to suggest) is to use an external service to determine where your Apex code is executing. This would probably be difficult to pull off, as every time the SalesForce server farm changes there is a change your code would break, but I just thought I'd throw this out there.
HttpRequest req = new HttpRequest();
req.setEndpoint('http://www.whatismyip.com/automation/n09230945.asp');
req.setMethod('GET');
Http http = new Http();
HTTPResponse res = http.send(req);
System.debug(res.getBody());
You have to add "http://www.whatismyip.com" to the Remote Site settings to get this to work (Setup > Administration Setup > Security Controls > Remote Site Settings). This code should run in the debug window when you click "System Log".
In your apex code you can use the following to get the instance of SF that you are in.
Keeping it dynamic will make sure you don't have to update your code when your org is migrated to a different instance.
String s = System.URL.getSalesforceBaseUrl().getHost();
//this will return "na1.salesforce.com" or "na1-api.salesforce.com",
// where na1 is your instance of SF, and -api may be there depending on where you run this
s = s.substring(0,s.indexOf('.'));
if(s.contains('-'))
{
s = s.substring(0,s.indexOf('-'));
}
system.debug(s);
There is a similar question on the Salesforce StackExchange for detecting if you are in a Sandbox or not - Can we determine if the Salesforce instance is production org or a Sandbox org?
In the solutions in search of a problem category, you could use the pod identifier from the OrgId to determine if you are dealing with a sandbox.
string podId = UserInfo.getOrganizationId().substring(3,4);
boolean isSandbox = 'TSRQPONMLKJZVWcefg'.contains(podId);
System.debug('IsSandbox: ' + isSandbox);
Caveat Confector: The big weakness here is that you will need to update the list of know sandbox pods as and when Salesforce brings new ones online (so it might be safer sticking with the other solutions).
You can use the following code block from Michael Farrington an authority on Salesforce.
Original blog post here: Michael Farrington: Where Am I Method
This method will return true if you are in a test or sandbox environment and false otherwise.
public Static Boolean isSandbox(){
String host = URL.getSalesforceBaseUrl().getHost();
String server = host.substring(0,host.indexOf('.'));
// It's easiest to check for 'my domain' sandboxes first
// even though that will be rare
if(server.contains('--'))
return true;
// tapp0 is a unique "non-cs" server so we check it now
if(server == 'tapp0')
return true;
// If server is 'cs' followed by a number it's a sandbox
if(server.length()>2){
if(server.substring(0,2)=='cs'){
try{
Integer.valueOf(server.substring(2,server.length()));
}
catch(exception e){
//started with cs, but not followed by a number
return false;
}
//cs followed by a number, that's a hit
return true;
}
}
// If we made it here it's a production box
return false;
}