function applyHero(id) {
  var elem = $(id).parents('.slds-tabs_default__content');
  var user = array.personas.hero[parseInt(elem.find('select[role="hero-selector"]').val() - 1)];
  var seenDate = new Date(new Date() - (user.daysFirstSeen*24*60*60*1000));
  var joinDate = new Date(new Date() - (user.daysJoined*24*60*60*1000));
  var sysDate = new Date();

  // Update form values
  elem.find('input[aria-label="attribute-id"]').val(user.name);
  elem.find('input[aria-label="attribute-name"]').val(user.name);
  elem.find('input[aria-label="attribute-email"]').val(user.emailAddress);
  elem.find('input[aria-label="attribute-key"]').val(user.contactKey);
  elem.find('input[aria-label="attribute-date"]').val(seenDate.toISOString().substring(0,16));
  elem.find('input[aria-label="attribute-joined"]').val(joinDate.toISOString().substring(0,16));
  elem.find('input[aria-label="attribute-last-seen"]').val(sysDate.toISOString().substring(0,16));
  // Show form
  $(id).parents('.slds-tabs_default__content').find('div[aria-label="section-user-method"]').addClass('slds-hide');
  $(id).parents('.slds-tabs_default__content').find('div[aria-label="section-user-attributes"]').removeClass('slds-hide');
}
// Apply hero attributes from pre-configured template
Apply hero attributes from pre-configured template
Apply hero attributes from pre - configured template
function applyHero(id) {
  var elem = $(id).parents('.slds-tabs_default__content');
  var user = array.personas.hero[parseInt(elem.find('select[role="hero-selector"]').val() - 1)];
  var seenDate = new Date(new Date() - (user.daysFirstSeen*24*60*60*1000));
  var joinDate = new Date(new Date() - (user.daysJoined*24*60*60*1000));
  var sysDate = new Date();
  elem.find('input[aria-label="attribute-id"]').val(user.name);
  elem.find('input[aria-label="attribute-name"]').val(user.name);
  elem.find('input[aria-label="attribute-email"]').val(user.emailAddress);
  elem.find('input[aria-label="attribute-key"]').val(user.contactKey);
  elem.find('input[aria-label="attribute-date"]').val(seenDate.toISOString().substring(0,16));
  elem.find('input[aria-label="attribute-joined"]').val(joinDate.toISOString().substring(0,16));
  elem.find('input[aria-label="attribute-last-seen"]').val(sysDate.toISOString().substring(0,16));
  $(id).parents('.slds-tabs_default__content').find('div[aria-label="section-user-method"]').addClass('slds-hide');
  $(id).parents('.slds-tabs_default__content').find('div[aria-label="section-user-attributes"]').removeClass('slds-hide');
}
function applyHero ( id ) { var elem = $ ( id ) . parents ( '.slds-tabs_default__content' ) ; var user = array . personas . hero [ parseInt ( elem . find ( 'select[role="hero-selector"]' ) . val ( ) - 1 ) ] ; var seenDate = new Date ( new Date ( ) - ( user . daysFirstSeen * 24 * 60 * 60 * 1000 ) ) ; var joinDate = new Date ( new Date ( ) - ( user . daysJoined * 24 * 60 * 60 * 1000 ) ) ; var sysDate = new Date ( ) ; elem . find ( 'input[aria-label="attribute-id"]' ) . val ( user . name ) ; elem . find ( 'input[aria-label="attribute-name"]' ) . val ( user . name ) ; elem . find ( 'input[aria-label="attribute-email"]' ) . val ( user . emailAddress ) ; elem . find ( 'input[aria-label="attribute-key"]' ) . val ( user . contactKey ) ; elem . find ( 'input[aria-label="attribute-date"]' ) . val ( seenDate . toISOString ( ) . substring ( 0 , 16 ) ) ; elem . find ( 'input[aria-label="attribute-joined"]' ) . val ( joinDate . toISOString ( ) . substring ( 0 , 16 ) ) ; elem . find ( 'input[aria-label="attribute-last-seen"]' ) . val ( sysDate . toISOString ( ) . substring ( 0 , 16 ) ) ; $ ( id ) . parents ( '.slds-tabs_default__content' ) . find ( 'div[aria-label="section-user-method"]' ) . addClass ( 'slds-hide' ) ; $ ( id ) . parents ( '.slds-tabs_default__content' ) . find ( 'div[aria-label="section-user-attributes"]' ) . removeClass ( 'slds-hide' ) ; }
Apply hero attributes from pre-configured template
Apply hero attributes from pre - configured template
// Update form values // Show form