• Ben Males
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 9
    Replies
Hi All,

I'm trying to alert the User when a particualr value is selected within a picklist. 

In Object Manager I have the Standard Object, Case
Case Standard Object

And in the Case Standard Object I have the Case Reason with the field label and field name Case Reason and Reason respectively with the type Data Type picklist.

Within the picklist I have the Case Reason Picklist Values such as Accounts, ALL - Bank Holiday Routing etc.

On the Case Page Layout I have added a Visualforce Page and what I'm trying to do is to alert / popup a warning if the User selects a particular value - example Apex below
<apex:page standardController="Case">
    <apex:outputText id="myScript">
        <script>
            if(!Case.Reason == "ALL - Bank Holiday Routing") {
                window.alert("Alert");
                }
        </script>
    </apex:outputText>
    <apex:form >
        <apex:inputField value="{!Case.Reason}">
            <apex:actionSupport event="onselect" reRender="myScript"/>
        </apex:inputField>
    </apex:form>    
</apex:page>
However, currently nothing is displayed to the User so how can I display an alert when the User selects a value?

Any help greatly appreciated.
 
Hi All,

I have the below Apex code running via a button on the Contact page
public with sharing class auto_sendSMS 
{
    public String phone {get;set;}

    public auto_sendSMS(ApexPages.StandardController stdController) {
    Contact contact = (Contact)stdController.getRecord();
    contact = [SELECT Id, phone from contact where Id = :contact.Id];
    
    String username = 'apiUser';
    String password = 'z448rcqAQ7w55ySK';
    String fromID = 'Cirrus';
    String dest = contact.phone;
    String body = 'API test';
    
    String requestEndpoint = 'https://auto.cirrusresponse.com/auto_sendSMS.asp';
    requestEndpoint += '?u=' + username;
    requestEndpoint += '&p=' + password;
    requestEndpoint += '&fromID=' + fromID;
    requestEndpoint += '&dest=' + dest;
    requestEndpoint += '&body=' + body;
    
    Http http = new http();
    HttpRequest request = new HttpRequest();
    request.setEndpoint(requestEndpoint);
    request.setMethod('POST');
    HttpResponse response = http.send(request);
    
    }

}
I have set the remote site settings for the endpoint, but the request is never received.

I'd greatly appreciate if anyone can advise me where I've gone wrong in the above as the non-Apex version of the code is running sucessfully through Postman.

Kind regards
Hi All,

I'm trying to alert the User when a particualr value is selected within a picklist. 

In Object Manager I have the Standard Object, Case
Case Standard Object

And in the Case Standard Object I have the Case Reason with the field label and field name Case Reason and Reason respectively with the type Data Type picklist.

Within the picklist I have the Case Reason Picklist Values such as Accounts, ALL - Bank Holiday Routing etc.

On the Case Page Layout I have added a Visualforce Page and what I'm trying to do is to alert / popup a warning if the User selects a particular value - example Apex below
<apex:page standardController="Case">
    <apex:outputText id="myScript">
        <script>
            if(!Case.Reason == "ALL - Bank Holiday Routing") {
                window.alert("Alert");
                }
        </script>
    </apex:outputText>
    <apex:form >
        <apex:inputField value="{!Case.Reason}">
            <apex:actionSupport event="onselect" reRender="myScript"/>
        </apex:inputField>
    </apex:form>    
</apex:page>
However, currently nothing is displayed to the User so how can I display an alert when the User selects a value?

Any help greatly appreciated.
 
Hi All,

I have the below Apex code running via a button on the Contact page
public with sharing class auto_sendSMS 
{
    public String phone {get;set;}

    public auto_sendSMS(ApexPages.StandardController stdController) {
    Contact contact = (Contact)stdController.getRecord();
    contact = [SELECT Id, phone from contact where Id = :contact.Id];
    
    String username = 'apiUser';
    String password = 'z448rcqAQ7w55ySK';
    String fromID = 'Cirrus';
    String dest = contact.phone;
    String body = 'API test';
    
    String requestEndpoint = 'https://auto.cirrusresponse.com/auto_sendSMS.asp';
    requestEndpoint += '?u=' + username;
    requestEndpoint += '&p=' + password;
    requestEndpoint += '&fromID=' + fromID;
    requestEndpoint += '&dest=' + dest;
    requestEndpoint += '&body=' + body;
    
    Http http = new http();
    HttpRequest request = new HttpRequest();
    request.setEndpoint(requestEndpoint);
    request.setMethod('POST');
    HttpResponse response = http.send(request);
    
    }

}
I have set the remote site settings for the endpoint, but the request is never received.

I'd greatly appreciate if anyone can advise me where I've gone wrong in the above as the non-Apex version of the code is running sucessfully through Postman.

Kind regards