• Shruti S
  • SMARTIE
  • 1865 Points
  • Member since 2017
  • Salesforce Developer


  • Chatter
    Feed
  • 58
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 330
    Replies

Hi All,

I need to parse below code in JSON format to insert multiple records at a time... i have done for single record to be inserted...For inserting multiple records through web service , how it will be done



@RestResource(urlMapping='/showAccountDetails/*')
global with sharing class NewCustomerCreation
{
 @HttpPost

 global static string doPost(String name)
 {
  RestRequest req = RestContext.request;
  RestResponse res = RestContext.response;
  res.addHeader('Content-Type', 'application/json');
  String jsonResponse = '';
  String accountName = req.params.get('account_name');
  Integer PInstallations = Integer.ValueOf(req.params.get('Potential_Installations__c')); 
  String Muncipaly = req.params.get('Municipaly__c');
  String CustSegment = req.params.get('Customer_Segment_Lookup__c'); 
  String CustHousingType = req.params.get('Housing_Type_Lookup__c'); 
  String CustHousingOwnership = req.params.get('Housing_Ownership_Lookup__c');  

  //Inserting records into Account
  
  Account acc= new Account();
  acc.name=accountName;
  acc.Potential_Installations__c= PInstallations;
  acc.Municipaly__c='Muncipaly';
  acc.Customer_Segment_Lookup__c ='CustSegment';
  acc.Housing_Type_Lookup__c ='CustHousingType';
  acc.Housing_Ownership_Lookup__c = 'CustHousingOwnership';
  insert acc;
  return acc.id;
      
}


below is the required format


{
"Account" :[{
 "cableunit_name":"",
              "cableunit_number":"",
              "potential_installation":"",
              "municipality":"",
              "postcode":"",
              "customer_segment":"",
              "Housing_type":"",
              "building_type":"",
              "housing_ownership":""
}
      
    },{
     "cableunit_name":"",
              "cableunit_number":"",
              "potential_installation":"",
              "municipality":"",
              "postcode":"",
              "customer_segment":"",
              "Housing_type":"",
              "building_type":"",
              "housing_ownership":""
}
    },{
    "attributes" :  "cableunit_name":"",
              "cableunit_number":"",
              "potential_installation":"",
              "municipality":"",
              "postcode":"",
              "customer_segment":"",
              "Housing_type":"",
              "building_type":"",
              "housing_ownership":""
}
    },{
    "cableunit_name":"",
              "cableunit_number":"",
              "potential_installation":"",
              "municipality":"",
              "postcode":"",
              "customer_segment":"",
              "Housing_type":"",
              "building_type":"",
              "housing_ownership":""
}
    }]
}


please help

Thanks & Regards
Pranav Shah
Today I built this pretty basic stopwatch visualforce page. I made it in a dev org and then once I was finished, I wanted to put it into a sandbox for a clients org. The code ran perfectly fine in my dev org, but when I put it in the sandbox, i went to preview it and the page went blank and the URL was "Not secure". Why am I getting this? How can I get around "unsecure" script? Does this page just not work in sandboxes?

here is my code: 
Visualforce Page:
<apex:page lightningStylesheets="false">
    <html>
  <head>
    <title>Timecard Stopwatch</title>
      <apex:slds />
      <meta name="viewport" content="width=device-width"/>
    <script src="http://fb.me/react-0.13.1.js"></script>
    <script src="http://fb.me/JSXTransformer-0.13.1.js"></script>
  </head>
                 
  <body style="background-color:white;">
  <script type="text/jsx">
    var StopWatch = React.createClass({
      getInitialState: function() {
        return {
          isStart: false,
          elapsed: 0,
          diff: 0,
          laps: [],
        };
      },
      componentWillUnmount: function() { // clear timer
        clearInterval(this.state.timer);
        this.setState({timer: undefined});
      },
      tick: function() {
        var elapsed = Date.now() - this.state.start + this.state.diff;
        this.setState({elapsed: elapsed});
      },
      getTimeSpan: function(elapsed) { // 754567(ms) -> "12:34.567"
        var m = String(Math.floor(elapsed/1000/60)+100).substring(1);
        var s = String(Math.floor((elapsed%(1000*60))/1000)+100).substring(1);
        var ms = String(elapsed % 1000 + 1000).substring(1);
        return m+":"+s+"."+ms;
      },
      onClick: function() {
        if(!this.state.isStart) { // start
          var timer = setInterval(this.tick, 33);
          this.setState({
            isStart: true,
            timer: timer,
            start: new Date(),
          });
        } else { // pause
          clearInterval(this.state.timer);
          this.setState({
            timer: undefined,
            isStart: false,
            diff: this.state.elapsed,
          });
        }
      },
      setLap: function() {
        var lapElapsed = this.state.laps.length ? this.state.laps[0].elapsed : 0;
        var lapTitle = "Lap"+(this.state.laps.length+1);
        var lapTime = lapTitle+": "+this.getTimeSpan(this.state.elapsed - lapElapsed)
        var lapElem = { label: lapTime, elapsed: this.state.elapsed };
        this.setState({laps: [lapElem].concat(this.state.laps)});
      },
      reset: function() {
        clearInterval(this.state.timer);
        this.setState({
          timer: undefined,
          isStart: false,
          elapsed: 0,
          diff: 0,
          laps: [],
        });
      },
      render: function() {
        return (
          <div class="slds-scope">
            <h1>{this.getTimeSpan(this.state.elapsed)}</h1>
            <button onClick={this.onClick} style={style.button}>
              {this.state.isStart ? "pause" : "start"}
            </button>
            <button onClick={this.setLap} style={style.button}>lap</button>
            <button onClick={this.reset} style={style.button}>reset</button>
            <ul style={style.lap}>
              {this.state.laps.map(function(lap) {
                return <li key={lap.id}>{lap.label}</li>;
              })}
            </ul>
          </div>
        );
      }
    });
 
    var style = {
      button: {
        fontSize: 15,
        height: 40,
        width: 60,
        margin: 10,
        background: "#F7941D",
        border: "3px",
         
      },
      lap: {
        fontSize: 20,
        padding: 10,
        listStyleType: 'circle',
      },
    
    };
 
    React.render( <StopWatch />, document.body );
  </script>
  </body>
</html>
</apex:page>
We want to prevent users from being able to close tasks with "TBD" in the subject line.
Hello All,

I am trying to test run a nintex app (DocGen/Drawloop) and it works fine in production but I cannot get it to run without an error in sandbox. 
Nintex customer service told me the following when I shared the errors with them:
"For the newest error you provided, that is actually a Salesforce error. This is what our Error Browser mentions: Unable to serialize property of 'records' on type common.api.soap.wsdl.QueryResult Error Id: 821496744-32366 (816038562). You will need to reach out to Salesforce to confirm what exactly is occurring."

Here is the code I am using for the button (it's exactly the same as the production Org) and showing No Syntax Error:

{!REQUIRESCRIPT("/soap/ajax/25.0/connection.js")} 

//GRABS THE IDS FROM THE LIST VIEW 
var selectedIds = {!GETRECORDIDS($ObjectType.Candidacy__c)}; 

// CREATES AN ARRAY 
var records = []; 

// INCREMENTALLY LOOPS THROUGH THE ARRAY WHILE CHECKING A CHECKBOX CALLED RUN DDP NEXTGEN  
for (var i = 0; i < selectedIds.length; i++) { 
var record = new sforce.SObject("Candidacy__c"); 
record.Id = selectedIds[i]; 
// If this field is not a checkbox, the value (1) will also need to change. 
record.RUN_DDP_NEXTGEN__c = 1 
records.push(record); 


// ERROR CHECKING 
try 

var update = sforce.connection.update(records); 
if (update && update[0] && update[0].errors && update[0].errors.message) 
alert(update[0].errors.message); 
else 
alert('Your request'+(records.length == 1 ? ' is' : 's are')+' being processed.'); 

catch (err) 

alert('An error has occurred. Please try again. '+err); 
}


Any help would be greatly appreciated.

Thanks,

trigger TriggerTo_Delete_AccountLookup on Account (before delete) {

     

    //To store parent ids

    list<id> AccountIds=new list<id>();

    for(Account accountVar:trigger.old)

    {

        AccountIds.add(accountVar.id);

    } 

    //Collecting all child records related to Parent records

    list<AccountLookup__c> listOfAccountLookup=[select Account_Name__r.Id from AccountLookup__c where Account_Name__r.Id in :AccountIds];

    system.debug('listOfAccountLookup'+listOfAccountLookup);

    //deleting child records

    delete listOfAccountLookup;
I need to fetch ListViews and related filters, say for Account object. I know StandardSetContoller has methods - getListViewOptions() and getFilterId() methods which are helpful. However, the maximum record limit for StandardSetController is 10,000 records. In my case there are records more than 10,000. How do I implement this so that I can handle records more than 10,000?
I created a custom button on custom object.
Behavior= "Execute Javascript"
Content Source="Onclick Javascript"
I have written the following code in sandbox. It is working in Sandbox. But, In Production, Formula values are not getting.
if({!productForce__c.Channel_code__c<>'Z0'&&productForce__c.Channel_code__c<>'Z4'}) {
   alert('{!$Label.Alert_for_projected_stock}');
   } else {

   window.open("https://{!productForce__c.SAP_Environment__c}.corp.inpkg.net:{!productForce__c.PORT_for_SAP_URL__c}/sap/bc/webdynpro/sap/zbu_apo_projected_stock?sap-language={!productForce__c.Language_Code__c}&company= 
{!productForce__c.Country_Name__c}&BASEPRODUCT= 
{!productForce__c.PBcode__c}&OK_CODE=EXECUTE#");
   }

sanbox URL when we click on button:
https://scmdev.corp.inpkg.net:8400/sap/bc/webdynpro/sap/zbu_apo_projected_stock?sap-language=FR&company=FRANCE&BASEPRODUCT=8022735&OK_CODE=EXECUTE#

Production URL when we click on button:
https://corp.inpkg.net/sap/bc/webdynpro/sap/zbu_apo_projected_stock?sap-language=&company=&BASEPRODUCT=8006451&OK_CODE=EXECUTE#

Can anyone please guide on this. How to achieve this?
 
I want distinct value of Family:
List<Product2> res= [select Family From Product2  where Family !='None' GROUP BY Family];

But it show error:
Illegal assignment from List<AggregateResult> to List<Product2>

Controller:
public List<sObject> MyProducts {get;set;}
 public void search(){ 
           string searchquery='select ProductCode,Name,ImageName__c,(Select 
          UnitPrice,Pricebook2.Name From PricebookEntries where IsActive=True)  from Product2 where name like \'%'+searchstring+'%\' Limit 20'; 
            MyProducts= Database.query(searchquery); 
}
visualforce page:
<apex:repeat value="{!MyProducts}" var="row">
                    <div >
                       <apex:image width="100p" height="100p" value="{!URLFOR($Resource.ProductImage, 'ProductImage/' & Value(row.ImageName__c))}"></apex:image>                 
                       <p>
                           <apex:outputText >{!row.Name}</apex:outputText>
                           <apex:repeat value="{!row.PricebookEntries}" var="PriceItem">
                                <apex:outputText >{!PriceItem.UnitPrice}</apex:outputText>
                           </apex:repeat>
                        </p>                                             
                    </div>
                </apex:repeat>

Can i use sObject in visualforce page?
 
Hi All,

I want to know the equivalent tags for each component in Visualforce page for the Lightning component. I am stuck with something else to understand about the dynamic binding on the Lightning component. Let's see an example:

Visualforce page code:
<apex:page controller="CaseCTRL">
<apex:form>
<apex:inputfield value="{!newcase.Subject}"/>  
<apex:inputfield value="{!newcase.Type}"/>
</apex:form>
</pex:page>

Controller Apex class:
public class CaseCTRL{

public case newcase{get;set;} //Declared a Sobject variable for accessing on VF page
public CaseCTRL(){
newcase = new case(); //Case Sobject varible initialization
}



I hope you could understand that code. I need same equivalent code for the lightning component too. Please, anyone, help me to understand.


Thanks,
Rakshana
I want list of public groups in my org but as I am quering [select id , group.name from group] it's giving me a list  with some other records as well as I've created only one group it should show only one record but it's showing  queues record, public group records, and some other records.

Please help.
Hi Devs ,
I have a component which is invoked through quick action present in event record page .The component is referring to force:hasRecordId interface .
The value of recordid is resulting to  undefined  when debugged. 
<!--component>

<aura:component controller="customLookUpController" implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction">
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
</aura:component>

<!--controller>
({
    doInit: function(component,event,helper) {
        var getId = component.get("v.recordId");   -- > undefined 
},
})
  • June 27, 2018
  • Like
  • 0
I have not written an apex class yet so I'm not sure i have the hang of this yet.  I am needing to update two custom account fields to null once a date field has been met.  Im going the route of apex class because i need to add it to the scheduler for the update versus using workflow or process builder.  

Scenario:  When the TSS Temporary End Date = TODAY(), i want to update the TSS Designation field (picklist) to Null and update the TSS Temporary End Date to Null.

public class update_tss_fields {
    public static String saveData(){
        for (Account a : [SELECT Id FROM Account WHERE TSS_Temporary_End_Date__c = TODAY()]){
               if (a.TSS_Temporary_End_Date__c = TODAY()){ 
                   a.TSS_Designation__C = null;
                   a.TSS_Temporary_End_Date__c = null;
                   update a;
               } 
               }    
        }
     }


I've tried 'UPDATE', 'IF' and when i try to save it get an error when using those expressions.  So im now getting this error: Error: Compile Error: Expecting ']' but was: '(' at line 3 column 89) 

Any help would be appreciated.

I did recieve the following updated code from another user in the community but it did not resolve my issue.  I get a new error:  Error: Compile Error: Method does not exist or incorrect signature: void TODAY() from the type update_tss_fields at line 4 column 85

public class update_tss_fields {
    public static String saveData(){
     List<Account> accountsToUpdate = new LIST<Account>();
        for (Account a : [SELECT Id FROM Account WHERE TSS_Temporary_End_Date__c =: TODAY()]){
               if (a.TSS_Temporary_End_Date__c = TODAY()){ 
                   a.TSS_Designation__C = null;
                   a.TSS_Temporary_End_Date__c = null;
                   accountsToUpdate.add(a); // make use of collections to store records
                 
               } 
               }    
update accountsToUpdate; // do the dml outside of for loop
        }
     }
Hi All,
I am new to salesforce.
I have defined recordtypeid in one class. I want to to call this id in SOQL query of another class. like in where condition of SOQL query.
How to this. This is my sample code.
 
public class A{
public static final Id RT_Parent = getRecordTypeId('MarketingRT', 'Obj1__c');
​}
public class B{
Obj1__c o=[SELECT Id FROM obj1__c WHERE  RecordTypeId =: ]
​}

I want to declare recordtype id in class A and I want to call it in class B. How to do this?

Please help me

Thank you in Advance
 
Hey Folks, I have a validation rule on a field for NOT( ISCHANGED) ). I have a button that is triggering this rule when pressed even though the field has been changed. I can't figure out a way around it. Any ideas? This is the button:

{!REQUIRESCRIPT("/soap/ajax/39.0/connection.js")} 

try { 
var newRecords = []; 
var c = new sforce.SObject("Request_for_Information_RFI__c"); 
c.id ="{!Request_for_Information_RFI__c.Id}"; 
c.Submit_RFI__c= true; 
c.Approval_Submitted__c= true; 
newRecords.push(c); 
result = sforce.connection.update(newRecords); 

if( result[0].getBoolean( "success" ) ) { 
window.location.reload(); 

else { 
alert( "An error has occurred. Error:" + result ); 


catch( e ) { 
alert( "An unexpected error has occurred. Error:" + e ); 
}
How to use HYPERLINK in Formula (Number) type field?

Like, There is a exisitng field UserId__c (Number[18,0]).
I want to set custom HYPERLINK value and along with UserId__c value.
HYPERLINK("?id=" & TEXT(UserId__c), UserId__c)
On creation of Formula(Number) field. It will give Error: Incorrect argument type for function 'HYPERLINK()'.

Please help!

Thanks,
Prashant Raiyani
Below trigger counts no of contacts and updates on noofcontacts__c on account .Now i need to write testclass for this 
As i am new to apex can someone help me with this .
Thanks in advance.


CODE:
trigger countofcontacttrigger on Contact (after insert) {

LIST<ID> ids=new LIST<ID>();

for(contact conn:trigger.new){
    

     ids.add(conn.accountid);
}

LIST<ACCOUNT> acc=[SELECT noofcontacts__c,(SELECT id from contacts) from account where id in:ids];
LIST<ACCOUNT> acc1=new LIST<ACCOUNT>();
for(account acc2:acc){

    acc2.noofcontacts__c=acc2.contacts.size();
    acc1.add(acc2);


}
update acc1;

}
Hi,

  Added below validation on a custom field in account not sure why this is getting fired when opportunity is created or updated. Please suggest me how to make this validation to fire only on a account. 

 NOT( REGEX( Email_Domain__c , "[a-zA-Z0-9.']+"))

Thanks
Sudhir
  • July 19, 2017
  • Like
  • 0
Hello
Having a problem completing the "Create a Custom List Button" (step 20).  When I click save, I get pop-up box that tells "Saving Layout" (see below).   But this does not stop. 

User-added image
  • July 18, 2017
  • Like
  • 0
Hi
How can i show an image as response of message on the chatbot.

User-added image

thanks for your coments
I have a button that I have incorporated some validation rule into for fields that need to be filled in. I am having issue with the fields that are picklists. Below is the code I have but the error I am getting is:<span class="errorStyle">Error: Syntax error. Missing '}'</span>

{!REQUIRESCRIPT("/soap/ajax/42.0/connection.js")} 

var isFilled = {!NOT(ISBLANK( Contact.Start_Date__c  ))};
var isFilled = {!NOT(ISBLANK( Contact.Escort_Day_1__c ))};
var isFilled = {!TEXT( Contact.Preferred_Computer__c  <>  '' ))};
var isFilled = {!TEXT( Contact.Office_Location__c  <>  ''  ))};
var isFilled = {!TEXT( Contact.Riskonnect_Department__c  <>  ''  ))};
var isFilled = {!TEXT( Contact.Accounting_Department__c  <>  '' ))};

if( isFilled){var contactRec = new sforce.SObject( "Contact" );
var records = sforce.connection.query("SELECT Id, Onboarding_Process_Builder_Trigger__c FROM Contact Where id = '{!Contact.Id}'");
var contactRec = records.getArray('records')[0];  



    contactRec.Onboarding_Process_Builder_Trigger__c = {!Contact.Onboarding_Process_Builder_Trigger__c} + 1; 

 sforce.connection.update([contactRec]); 
    window.location.reload();}

else {alert( "Employment Section is required." );}
Hi all, so recently we've had issues with Chrome blocking our Popup Alert app that we have installed. The developer isn't making anymore updates. Is there a way I can just create it myself? The issue we are having is that the alert will not show up in Chrome, but in other browers. Thoughts?
Is there a specific file type (i.e. .jpg, .png, jfif) that the images need to be in order for einstein vision to work?

I am trying to build a "fast flow", but have never designed anything with a loop. I can make it work on an individual basis, but turning into a bulkify process I am struggling with.

I have two Objects. 
1. Opportunities (standard object)
2. Client_Details__c (custom)

On both objects there is a custom field called Client_Number__c.
I need a flow that kicks off every morning that checks for any Client_Details__c records that do not have the look up field Opportunity__c field filled out. It then takes those records and compares the Client__Number field on the Client_Detials record against the Client_Number on all the Opportunity records to find a match. Once found it takes the ID for the Opportunity and inputs it to the Opportunity__c field on the Client_Detials record. After all have been processed, it updates all the records as one action. 

 

Any assistance would be great.

This my webservice:
@RestResource(urlMapping='/Cases/*')
global with sharing class CaseManager {
global static Map<String,List<Case>> getCaseById() {
        RestRequest request = RestContext.request;       
        String caseId = request.requestURI.substring(
          request.requestURI.lastIndexOf('/')+1);
        List<Case> result;   
          result =  [SELECT CaseNumber,Subject,Status,Origin,Priority
                        FROM Case Where Id=:caseId];     
        Map<String,List<Case>> res=new Map<String,List<Case>>();
        res.put('Cases', result);
        return res;
    }
 @HttpPost
    global static ID createCase(String subject, String status,
        String origin, String priority) {
        Case thisCase = new Case(
            Subject=subject,
            Status=status,
            Origin=origin,
            Priority=priority);
        insert thisCase;
        return thisCase.Id;
    }   
 @HttpPost
  global static Map<String,List<Case>> getDataGroupOfUser(String userid, String group)
   {     
       List<Case> result;   
          result =  [SELECT CaseNumber,Subject,Status,Origin,Priority
                        FROM Case Where userId__c=:userid and group__c=:group];     
        Map<String,List<Case>> res=new Map<String,List<Case>>();
        res.put('Cases', result);
        return res;
    }   
}

Error: Only one method per type can be defined with: HttpPost
How can define multi function get or post in a class of webservice?

Hi All,

I need to parse below code in JSON format to insert multiple records at a time... i have done for single record to be inserted...For inserting multiple records through web service , how it will be done



@RestResource(urlMapping='/showAccountDetails/*')
global with sharing class NewCustomerCreation
{
 @HttpPost

 global static string doPost(String name)
 {
  RestRequest req = RestContext.request;
  RestResponse res = RestContext.response;
  res.addHeader('Content-Type', 'application/json');
  String jsonResponse = '';
  String accountName = req.params.get('account_name');
  Integer PInstallations = Integer.ValueOf(req.params.get('Potential_Installations__c')); 
  String Muncipaly = req.params.get('Municipaly__c');
  String CustSegment = req.params.get('Customer_Segment_Lookup__c'); 
  String CustHousingType = req.params.get('Housing_Type_Lookup__c'); 
  String CustHousingOwnership = req.params.get('Housing_Ownership_Lookup__c');  

  //Inserting records into Account
  
  Account acc= new Account();
  acc.name=accountName;
  acc.Potential_Installations__c= PInstallations;
  acc.Municipaly__c='Muncipaly';
  acc.Customer_Segment_Lookup__c ='CustSegment';
  acc.Housing_Type_Lookup__c ='CustHousingType';
  acc.Housing_Ownership_Lookup__c = 'CustHousingOwnership';
  insert acc;
  return acc.id;
      
}


below is the required format


{
"Account" :[{
 "cableunit_name":"",
              "cableunit_number":"",
              "potential_installation":"",
              "municipality":"",
              "postcode":"",
              "customer_segment":"",
              "Housing_type":"",
              "building_type":"",
              "housing_ownership":""
}
      
    },{
     "cableunit_name":"",
              "cableunit_number":"",
              "potential_installation":"",
              "municipality":"",
              "postcode":"",
              "customer_segment":"",
              "Housing_type":"",
              "building_type":"",
              "housing_ownership":""
}
    },{
    "attributes" :  "cableunit_name":"",
              "cableunit_number":"",
              "potential_installation":"",
              "municipality":"",
              "postcode":"",
              "customer_segment":"",
              "Housing_type":"",
              "building_type":"",
              "housing_ownership":""
}
    },{
    "cableunit_name":"",
              "cableunit_number":"",
              "potential_installation":"",
              "municipality":"",
              "postcode":"",
              "customer_segment":"",
              "Housing_type":"",
              "building_type":"",
              "housing_ownership":""
}
    }]
}


please help

Thanks & Regards
Pranav Shah
Today I built this pretty basic stopwatch visualforce page. I made it in a dev org and then once I was finished, I wanted to put it into a sandbox for a clients org. The code ran perfectly fine in my dev org, but when I put it in the sandbox, i went to preview it and the page went blank and the URL was "Not secure". Why am I getting this? How can I get around "unsecure" script? Does this page just not work in sandboxes?

here is my code: 
Visualforce Page:
<apex:page lightningStylesheets="false">
    <html>
  <head>
    <title>Timecard Stopwatch</title>
      <apex:slds />
      <meta name="viewport" content="width=device-width"/>
    <script src="http://fb.me/react-0.13.1.js"></script>
    <script src="http://fb.me/JSXTransformer-0.13.1.js"></script>
  </head>
                 
  <body style="background-color:white;">
  <script type="text/jsx">
    var StopWatch = React.createClass({
      getInitialState: function() {
        return {
          isStart: false,
          elapsed: 0,
          diff: 0,
          laps: [],
        };
      },
      componentWillUnmount: function() { // clear timer
        clearInterval(this.state.timer);
        this.setState({timer: undefined});
      },
      tick: function() {
        var elapsed = Date.now() - this.state.start + this.state.diff;
        this.setState({elapsed: elapsed});
      },
      getTimeSpan: function(elapsed) { // 754567(ms) -> "12:34.567"
        var m = String(Math.floor(elapsed/1000/60)+100).substring(1);
        var s = String(Math.floor((elapsed%(1000*60))/1000)+100).substring(1);
        var ms = String(elapsed % 1000 + 1000).substring(1);
        return m+":"+s+"."+ms;
      },
      onClick: function() {
        if(!this.state.isStart) { // start
          var timer = setInterval(this.tick, 33);
          this.setState({
            isStart: true,
            timer: timer,
            start: new Date(),
          });
        } else { // pause
          clearInterval(this.state.timer);
          this.setState({
            timer: undefined,
            isStart: false,
            diff: this.state.elapsed,
          });
        }
      },
      setLap: function() {
        var lapElapsed = this.state.laps.length ? this.state.laps[0].elapsed : 0;
        var lapTitle = "Lap"+(this.state.laps.length+1);
        var lapTime = lapTitle+": "+this.getTimeSpan(this.state.elapsed - lapElapsed)
        var lapElem = { label: lapTime, elapsed: this.state.elapsed };
        this.setState({laps: [lapElem].concat(this.state.laps)});
      },
      reset: function() {
        clearInterval(this.state.timer);
        this.setState({
          timer: undefined,
          isStart: false,
          elapsed: 0,
          diff: 0,
          laps: [],
        });
      },
      render: function() {
        return (
          <div class="slds-scope">
            <h1>{this.getTimeSpan(this.state.elapsed)}</h1>
            <button onClick={this.onClick} style={style.button}>
              {this.state.isStart ? "pause" : "start"}
            </button>
            <button onClick={this.setLap} style={style.button}>lap</button>
            <button onClick={this.reset} style={style.button}>reset</button>
            <ul style={style.lap}>
              {this.state.laps.map(function(lap) {
                return <li key={lap.id}>{lap.label}</li>;
              })}
            </ul>
          </div>
        );
      }
    });
 
    var style = {
      button: {
        fontSize: 15,
        height: 40,
        width: 60,
        margin: 10,
        background: "#F7941D",
        border: "3px",
         
      },
      lap: {
        fontSize: 20,
        padding: 10,
        listStyleType: 'circle',
      },
    
    };
 
    React.render( <StopWatch />, document.body );
  </script>
  </body>
</html>
</apex:page>
Having an issue passing the record Id to a visualforce page with a controller exitension.

My URL is https://plumlending--lightning.lightning.force.com/lightning/n/Entity_View?=001m000000igKW8AAM

Controller:
public class entityViewControllerExtension {

    public Id recordId {get; set;}
    public Account acct {get;set;}
    
    // The extension constructor initializes the private member
    // variable acct by using the getRecord method from the standard
    // controller.
    public entityViewControllerExtension(ApexPages.StandardController stdController) {
        this.acct = (Account)stdController.getRecord();
        this.recordId = stdController.getId();
        system.debug('entityViewControllerExtension: acct.Id='+acct.Id);
        system.debug('entityViewControllerExtension: recordId='+recordId);      
    }
}
VF page:
<apex:page standardController="Account" extensions="entityViewControllerExtension" tabStyle="account">
    <apex:form >
        <apex:pageBlock>
            <apex:pageBlockSection columns="2">
                <apex:pageBlockSectionItem helpText="...">
                    <apex:outputLabel value="Entity View"/>
                    <apex:outputText> fields will go here </apex:outputText>
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem labelStyle="display:none;" dataStyle="display:none;">
                    <apex:outputText >&nbsp;</apex:outputText>
                    <apex:outputText >&nbsp;</apex:outputText>
                </apex:pageBlockSectionItem>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

I see null values from my debug statements and can't understand why. This must be an issue with the URL format as it works in classic but not lightning. 

Any help is much appreciated!
 
I have created a Flow which works well in Debug Mode and on Community portals but not on a Vf page. The error message is:
An unhandled fault has occurred in this flow
An unhandled fault has occurred while processing the flow. Please contact your system administrator for more information.

And the VF code is:

<apex:page >
  
         
          <flow:interview name="Eval_Survey"/>
       
     
</apex:page>
New to coding: 
I have the below code being used on a button to fire a process builder. I need add a rule to make sure prior to the process builder being fired that the following field on the contact record "Termination__c" is not blank. 
If blank a message should appear = termation date is required AND the process builder does NOT fire until this termination date is filled in:

Current javascript in the button:
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/29.0/apex.js")} 
//Select the current contact records and put it into the record //variable 
var records = sforce.connection.query("SELECT Id, Offboarding_Process_Builder_Trigger__c FROM Contact Where id = '{!Contact.Id}'"); 
//Pull the contact object out of the records variable and set it to //contactRec 
var contactRec = records.getArray('records')[0]; 
//Increase contactRec Offboarding_Process_Builder_Trigger__c 
//JS sees the number field as a string so this will make sure that //is a number - Number(contactRec.Offboarding_Process_Builder_Trigger__c) 
contactRec.Offboarding_Process_Builder_Trigger__c = Number(contactRec.Offboarding_Process_Builder_Trigger__c) + 1; 
//Update contactRec object 
sforce.connection.update([contactRec]); 
//Reload the page 
window.location.reload();

I thought I could insert the below somewhere in the above to make it work?
//Termination field is requied when selecting the termination button
var contactReq = "{!Contact.Termination__c}";
if(contactReq != '') ;
else {
alert('Termination Date is required');

 
public static void checkDestination(Map<Id, order__c> newOrders, Map<Id, order__c> oldOrders){
        for(Id id : newOrders.keyset()){
            if(newOrders.get(id).Destination__c != oldOrders.get(id).Destination__c && newOrders.get(id).Destination__r.Name.contains(‘OverSeas’)){
                newOrders.get(id).Received__c =True;
            }
        }
    }
Simple class but when I use contains() in my lookup reference: destination__r.Name, it throws an error:
Unable to de-reference a null object

How can I write my class that if my destination lookup has the word “overseas” in it, it will set my orders received field to be true?
 
We want to prevent users from being able to close tasks with "TBD" in the subject line.