• Jayee
  • NEWBIE
  • 20 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 9
    Replies

Hello

In this Summer 19 Release, new fuctionality was added new process notification through the ProcessBuilder. (https://help.salesforce.com/articleView?id=process_action_customnotification.htm&type=5)

So i want to give a notification when the other user press certain 'like' button, owner of the record should have to get the 'Ring' shape notification alarm.

 

So i would like to use it on the Apex Code. not the process builder. i thought that Processbuilder could make it, Apex has to be made on the code as well.
Does anyone have applied this notification functionality?

Thanks for reading.

Jay

  • July 05, 2019
  • Like
  • 0

Hi all

Currently, sending a Employee enroll input form on a object H_HRBasic__c to the apex class method 

Emp_NM__c / Birth_YMD__c / Sex_Type__c /Email__c /Mobile_NO__c

CMP

<aura:attribute name="HRB_S" type="H_HRBasic__c" default="{'sobjectType':'H_HRBasic__c',
															   'Emp_NM__c':'',
															   'Birth_YMD__c':'',
															   'Sex_Type__c':'',
															   'Email__c':'',
															   'Mobile_NO__c':''}"/>
	<aura:attribute name="newHRB_S" type="H_HRBasic__c[]"/>
	<aura:attribute name="PsID" type="String" />

<lightning:input aura:id="hrbsform" name="Emp_NM__c" value="{!v.HRB_S.Emp_NM__c}" label="Name" required="true" type="String" style="margin-top:10px;" />

<lightning:input  aura:id="hrbsform" value="{!v.PsID}" label="SOCIALID" required="true" style="margin-top:10px;" />

<lightning:input aura:id="hrbsform" type="date" name="Birth_YMD__c" label="Birth date" value="{!v.HRB_S.Birth_YMD__c}" />

<lightning:select aura:id="hrbsform" label="M/F" name="Sex_Type__c" value="{!v.HRB_S.Sex_Type__c}">
 					      <option value="">--None--</option>
 					      <option value="Male">Male</option>
 					      <option value="Female">Female</option>
 </lightning:select>

<lightning:input aura:id="hrbsform" value="{!v.HRB_S.Email__c}" name="Email__c" label="Email" style="margin-top:10px;" />

<lightning:input  aura:id="hrbsform" value="{!v.HRB_S.Mobile_NO__c}" name="Mobile_NO__c" label="Phone" style="margin-top:10px;" />


<lightning:button  variant="neutral" label="save" onclick="{!c.getsaveIns}" />
 

Controller

getsaveIns : function(component, event, helper){

		var validhrbs = component.find("hrbsform").reduce(function (validSoFar,inputCmp){
			inputCmp.showHelpMessageIfInvalid();
			return validSoFar && inputCmp.get('v.validity').valid;
		}, true);
		//This is just for required field check


		if(validhrbs){
			var hrbs = component.get("v.HRB_S");
			var newhrbs = component.get("v.newHRB_S");
			var item = JSON.parse(JSON.stringify(hrbs));
			newhrbs.push(item);
			component.set("v.HRB_S",newhrbs);
			var psid = component.get("v.PsID");
			console.log('hrbs / /'+JSON.stringify(newhrbs));


			helper.setSaveIns(component,event,helper,newhrbs,psid);
		}


	},
 



Helper

setSaveIns : function(component,event,helper,newhrbs,psid){
        var action = component.get('c.saveIn_S');
        console.log('hrbs : : : : : '+newhrbs);
        console.log('psid : : : : : '+psid);
        action.setParams({

        	"HRB_S" : newhrbs,
        	"PsID"  : psid
        });

        action.setCallback(this, function(response){
            var result = response.getReturnValue();
            var state = response.getState();
            var toast = $A.get("e.force:showToast");

   			if(state == 'SUCCESS') {

   				console.log('SUCCES!!!!~'+JSON.stringify(result));

			} else {
   				console.log('fail'+JSON.stringify(result));

			}
			
        });
        $A.enqueueAction(action);
    },

Apex Class
@AuraEnabled
	public static void saveIn_S(H_HRBasic__c HRB_S, String PsID){
        // HRB_S =  new H_HRBasic__c;
        system.debug('psid : : : :'+psid);
        system.debug('HRB_S : : : :'+HRB_S);
        
        H_AssignBasic__c AssB_S = new H_AssignBasic__c();
        H_RetireBasic__c RB_S = new H_RetireBasic__c();
        H_AttendBasic__c AttB_S = new H_AttendBasic__c();
        H_HolsBasic__c HB_S = new H_HolsBasic__c();
        H_PayBasic__c PB_S = new H_PayBasic__c();
        H_4InsBasic__c Ins4B_S = new H_4InsBasic__c();
        H_YearTaxBasic__c YTB_S = new H_YearTaxBasic__c();
..

but it goes well after i instantiate a custom object H_HRBasic__c constructor on the apex method 
like 
H_HRBasic__c HRB_S = new H_HRBasic__c ();
        system.debug('psid : : : :'+psid);
        system.debug('HRB_S : : : :'+HRB_S);


ERROR ON DEVELOPER CONSOLE

18:26:33:002 USER_DEBUG [135]|DEBUG|HRB_S : : : :null

18:26:33:031 FATAL_ERROR System.NullPointerException: Attempt to de-reference a null object

I guess it is JSON stringify problem when i sending a javascript object to apex class

but I am not sure which way is the best way to solve it

Thanks for reading this.

  • September 21, 2018
  • Like
  • 0
User-added image
Hello~ 

For now , im using custom accordion code below
    <div class="divContainer">

        <div class="slds-p-around--medium">
            <div class="slds-grid slds-wrap slds-gutters_xx-small">
                <div class="slds-col slds-size--1-of-1 slds-small-size--1-of-1 slds-medium-size--1-of-1 slds-m-top_x-small">
                    <ul class="slds-accordion">
                        <li class="slds-accordion__list-item">
									<section class="slds-accordion__section slds-section__title">
										<div aura:id="RS_Initiation_2" class="slds-is-open slds-transition-show">
											<div class="slds-accordion__summary slds-section__title slds-theme_shade">
												<h3 class="slds-section__title">
													<lightning:button value="RS_Initiation_2" 
															ariaExpanded="true"
															class="slds-button slds-button_reset slds-accordion__summary-action slds-custom-button"
															onclick="{!c.divAccordionClick}">
														<lightning:icon aura:id="RS_Initiation_2_open" iconName="utility:chevronright" size="x-small" class="slds-first-icon"/>
														<lightning:icon aura:id="RS_Initiation_2_close" iconName="utility:chevrondown" size="x-small" class="slds-first-icon slds-display-none"/>
														<span class="slds-truncate">
															About
														</span>
													</lightning:button>

												</h3>
											</div>

											<div class="slds-accordion__content">
												<!--DATA ENTRY POINT-->
								
												<!--DATA ENTRY POINT-->
											</div>
										</div>
									</section>
								</li>
would like to add an smooth onclick accordion animation.
what should i change my code to add an opacity annimation like user detail page hide/show
NO JQuery Will be added
 
  • June 19, 2018
  • Like
  • 0
i have this code
public void addMore() {
        try{

            string nameT  = Apexpages.currentPage().getParameters().get('nameT');
            string phoneT = Apexpages.currentPage().getParameters().get('phoneT');
            string emailT = Apexpages.currentPage().getParameters().get('emailT');
            //string temporaryLastNameValue;
            //string temporaryFirstNameValue;

            system.debug('[addMore] param : ' +nameT + '//' + phoneT + '//' + emailT);


            Contact att = new Contact();
            att.lastname = nameT;

            att.phone = phoneT;
            att.email = emailT;


            contactList = new List<Contact>();
List<Contact> con = [SELECT Name, FirstName, LastName FROM Contact WHERE Name =  : nameT];

            contactList.add(att);    

            insert contactList;

//it displays nothing on the row...
//maybe it needs to be bind both firstname and lastname

        }catch(Exception e){
            System.debug('[CONTACT] message     : ' + e.getMessage());
            System.debug('[CONTACT] LineNumber  : ' + e.getLineNumber());
            System.debug('[CONTACT] Cause       : ' + e.getCause());
        }

system.debug('[addMore] param : ' +nameT + '//' + phoneT + '//' + emailT);
-> parameter value shows fullname but
in org's row , it shows nothing
to show this on the table row how should i edit these codes?

Thank you!
  • May 25, 2018
  • Like
  • 0

it keeps return not writeable error... how should i resolve this error?
 
private List<Contact> contactList;

   public void addMore() {
    

        string nameT = Apexpages.currentPage().getParameters().get('nameT');
        string phoneT = Apexpages.currentPage().getParameters().get('phoneT');
        string emailT = Apexpages.currentPage().getParameters().get('emailT');

    system.debug(nameT + '//' + phoneT + '//' + emailT);


    Contact att = new Contact();

    att.name = nameT;
    att.phone = phoneT;
    att.email = emailT;

    contactList.add(att);


 //i want this parameters to List value but it doesnt work properly..
  • May 24, 2018
  • Like
  • 0
Hi

i would like to modify a form when i choose a pick value which returns input field show up and hidden event
How could this be enable? i cant find where i sort this thing out.
  • April 03, 2018
  • Like
  • 0
I've followed the documentation from the Lightning Components Developer Guide on Dynamically Showing or Hiding Markup using a component, js controller and style elements. I was able to place the button on my lightning home page, however, when I click the button, the sample text does not disappear as shown. 

Has anyone run into this problem or is there something missing that wouldn't toggle the sample text provided?

https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/js_cb_show_hide_markup.htm

Component
<!--c:toggleCss-->
<aura:component>
    <lightning:button label="Toggle" onclick="{!c.toggle}"/>
    <p aura:id="text">Now you see me</p>
</aura:component>

js controller
/*toggleCssController.js*/
({
    toggle : function(component, event, helper) {
        var toggleText = component.find("text");
        $A.util.toggleClass(toggleText, "toggle");
    }
})

style
/*toggleCss.css*/
.THIS .toggle {
    display: none;
}

 
  • September 06, 2018
  • Like
  • 0
Hi there, Currently I have a formstack page. Within I see that I can add Javascript Code to the Send Button which is located at the bottom of the page. How can I link that button to a custom checkbox field that I have created in Salesforce.

For simplicity, I have added that field within that page. By default it is shown as a unselected checkbox. I want the checkbox to be checked when the button is pressed. Is there anyways that I can do that?

I have included my setup as well as the front end of the form below. Currently when I press the button 'Attach Pictures', the checkbox/custom field is not updated.

Any help is greatly appreciated, thanks. 

FormStack SetupFront End
We are using a lightning component as quick action on a record, with a flow embedded in it. Now when someone open this quick action it sometimes give an error. Any help is appreciated. 

.cmp
<aura:component implements="force:lightningQuickActionWithoutHeader,force:hasRecordId" >
    <ltng:require styles="{!$Resource.modalCSS}" />
	<aura:handler name="init" value="{!this}" action="{!c.init}" />
    <lightning:flow aura:id="flowData" onstatuschange="{!c.handleStatusChange}" />
</aura:component>
controller
({
    init : function (component) {
        // Find the component whose aura:id is "flowData"
        var flow = component.find("flowData");
        // In that component, start your flow. Reference the flow's Unique Name.
        var inputVariables = [
            { name : "recordId", type : "String", value: component.get("v.recordId") }
        ];
		// Start flow
        flow.startFlow("Teamwear_Internal_Flow",inputVariables);
    },
    handleStatusChange : function (component, event) {
        //Check if flow is finished
        if(event.getParam("status") === "FINISHED") {
            //redirect to record to force refresh
            var sobjectEvent=$A.get("e.force:navigateToSObject");
            sobjectEvent.setParams({
                "recordId": component.get("v.recordId")
            });
            sobjectEvent.fire();
        }
    }
})
Error:
lightning component with flow error

 
i have this code
public void addMore() {
        try{

            string nameT  = Apexpages.currentPage().getParameters().get('nameT');
            string phoneT = Apexpages.currentPage().getParameters().get('phoneT');
            string emailT = Apexpages.currentPage().getParameters().get('emailT');
            //string temporaryLastNameValue;
            //string temporaryFirstNameValue;

            system.debug('[addMore] param : ' +nameT + '//' + phoneT + '//' + emailT);


            Contact att = new Contact();
            att.lastname = nameT;

            att.phone = phoneT;
            att.email = emailT;


            contactList = new List<Contact>();
List<Contact> con = [SELECT Name, FirstName, LastName FROM Contact WHERE Name =  : nameT];

            contactList.add(att);    

            insert contactList;

//it displays nothing on the row...
//maybe it needs to be bind both firstname and lastname

        }catch(Exception e){
            System.debug('[CONTACT] message     : ' + e.getMessage());
            System.debug('[CONTACT] LineNumber  : ' + e.getLineNumber());
            System.debug('[CONTACT] Cause       : ' + e.getCause());
        }

system.debug('[addMore] param : ' +nameT + '//' + phoneT + '//' + emailT);
-> parameter value shows fullname but
in org's row , it shows nothing
to show this on the table row how should i edit these codes?

Thank you!
  • May 25, 2018
  • Like
  • 0

it keeps return not writeable error... how should i resolve this error?
 
private List<Contact> contactList;

   public void addMore() {
    

        string nameT = Apexpages.currentPage().getParameters().get('nameT');
        string phoneT = Apexpages.currentPage().getParameters().get('phoneT');
        string emailT = Apexpages.currentPage().getParameters().get('emailT');

    system.debug(nameT + '//' + phoneT + '//' + emailT);


    Contact att = new Contact();

    att.name = nameT;
    att.phone = phoneT;
    att.email = emailT;

    contactList.add(att);


 //i want this parameters to List value but it doesnt work properly..
  • May 24, 2018
  • Like
  • 0
Hi

i would like to modify a form when i choose a pick value which returns input field show up and hidden event
How could this be enable? i cant find where i sort this thing out.
  • April 03, 2018
  • Like
  • 0