• Kolli SFDC
  • NEWBIE
  • 10 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 3
    Replies
Need DML update details in trigger or apex.
if any field is updated? is there way to find that DML update happened from either manual or Data Loader or some other API.

Requirement:- If I update any field manually, do not want to update the same field from data loader or some other API.
I am facing couple of challenges with Dynamic SOSL.
Records are available with "test.abc1@test.digital or test.abc@test.com" and "(123) 456-7890"(based on locale).

we are using Dynamic SOSL query with multiple search terms and asterisk match (*)

Email field not working with :-

1)searchTerm ="@test.digital*"
2)searchTerm ="abc1*"
3)searchTerm ="abc1@test.digital*" or searchTerm =".abc1@test.digital*"

Phone number not working with :-

1)searchTerm ="890*"
2)searchTerm ="23)4*"
3)searchTerm ="67890*"

***We ant fetch records with any character from email field and any number from Phone number field.*** 

we tried multiple ways suggested by salesforce i.e. 
https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_sosl_find.htm

Code :-
SearchCaseByMultipleId(string searchText){
        String searchTerms = '(';
        for(string str : searchText.split(',')){
            if(str.length()>0){
               searchTerms  = searchTerms+' "' +str +'*'+'" '+'OR';
            }else{                
            }           
        }
        searchTerms = searchTerms.removeEnd('OR');
        searchTerms = searchTerms+')';
       string finalQuery = 'FIND :searchTerms IN ALL FIELDS RETURNING '+objectName+'(' + quryFields +' 
         ORDER BY CreatedDate DESC NULLS last)';
       list<list<Sobject>> results = search.query(finalQuery);
}
search term looks like :- ("@test.digital*" OR "abc1*").

is there any other way for my requirement or is something missing? 
Hi Folks,

We have a requirement like Table scroll should be horizontal and vertical but when we scroll vertically, title should be Freeze.
I have tried two scenario's 
1) Single Table:-  Horizantal scroll is working but when i scroll vertically table header also moving up.  But title should freeze.
2) Two tables:-  one is for Header and second is for body, but table alignments are not displaying properly.Even though two tables are having same width or measurement.

Finally i come to know one table is suitable for my requirement.

Please fine the below Code( title and body with One table).

Component:

<div class="panel">
        <div class="body_panel">
            <table class="slds-table slds-table_bordered slds-table_cell-buffer slds-truncate">
                <thead class="header">
                    <tr class="slds-text-title_caps">
                        <th scope="col">
                            <div class="slds-truncate" title="{!$Label.c.Actions}">{!$Label.c.Actions}</div>
                        </th>
                        <th scope="col">
                            <div class="slds-truncate" title="{!$Label.c.No_Label}">{!$Label.c.No_Label}</div>
                        </th>
                        <th scope="col">
                            <div class="slds-truncate" title="{!$Label.c.Title}">{!$Label.c.Title}</div>
                        </th>
                        <th scope="col">
                            <div class="slds-truncate" title="{!$Label.c.Flag}">{!$Label.c.Flag}</div>
                        </th>
                        <th scope="col">
                            <div class="slds-truncate" title="{!$Label.c.Owner_label}">{!$Label.c.Owner_label}</div>
                        </th>
                        <th scope="col">
                            <div class="slds-truncate" title="{!$Label.c.Last_Modified}">{!$Label.c.Last_Modified}</div>
                        </th>
                        <th scope="col">
                            <div class="slds-truncate" title="{!$Label.c.Size}">{!$Label.c.Size}</div>
                        </th>
                        <th scope="col">
                            <div class="slds-truncate" title="Article">Article</div>
                        </th>
                    </tr>
                </thead>
                <tbody class="body">
                    <aura:iteration items="{!v.Attachments}" var="item" indexVar="index">
                        <aura:if isTrue="{!item.display}">
                            <tr>
                                <td scope="row">
                                    <lightning:buttonmenu menualignment="right" title="{!item.ContentDocument.Title}"
                                        name="{!item.ContentDocument.LatestPublishedVersionId}"
                                        alternativetext="{!$Label.c.Settings}" onselect="{! c.handleMenuSelect }">
                                        <aura:if isTrue="{!item.isPreviewAvailable}">
                                            <lightning:menuitem aura:id="view" iconName="utility:preview"
                                                label="{!$Label.c.View}" value="view"
                                                title="{!$Label.c.View + ' ' +item.ContentDocument.Title}" />
                                        </aura:if>
                                        <lightning:menuitem aura:id="download" iconName="utility:download"
                                            label="{!$Label.c.Download}" value="download"
                                            title="{!$Label.c.Download+' ' +item.ContentDocument.Title}" />
                                        <lightning:menuitem aura:id="delete" iconName="utility:delete"
                                            label="{!$Label.c.Delete}" value="delete"
                                            title="{!$Label.c.Delete+' ' +item.ContentDocument.Title}" />
                                        <aura:if isTrue="{!and(item.ContentDocument.FileExtension=='csv',v.csvAccess)}">
                                            <aura:if
                                                isTrue="{!or(or(item.ContentDocument.Owner.Id == v.loggedUser, v.userProfile), v.Case.OwnerId == v.loggedUser)}">
                                                <lightning:menuitem aura:id="Edit" iconName="utility:edit"
                                                    label="{!$Label.c.LABS_SF_Edit}" value="Edit"
                                                    title="{!$Label.c.LABS_SF_Edit+' ' +item.ContentDocument.Title}" />
                                            </aura:if>
                                        </aura:if>
                                    </lightning:buttonmenu>
                                </td>
                                <td scope="row">
                                    {!item.counter}
                                </td>
                                <td scope="row" id="{!item.ContentDocument.LatestPublishedVersionId}"
                                    data-value="{!item.ContentDocument.Title}" data-visible="{!item.isPreviewAvailable}"
                                    data-id="{!item.ContentDocument.Id}" class="hover-pointer"
                                    onclick="{!c.openAttachViewer}">
                                    <div class="slds-media">
                                        <div class="slds-media__figure">
                                            <span class="slds-icon_container" title="">
                                                <lightning:icon iconName="{!item.icon}" size="medium" />
                                            </span>
                                        </div>
                                        <div class="slds-media__body">
                                            <h1 class="slds-text-heading_small slds-truncate slds-align-middle">
                                                {!item.ContentDocument.Title}</h1>
                                        </div>
                                    </div>
                                </td>
                                <td scope="row">
                                    <div onclick="{!c.changeFlag}"
                                        data-value="{!item.ContentDocument.LatestPublishedVersionId}"
                                        data-flag="{!v.namespace==''?item.ContentDocument.LatestPublishedVersion.Flag__c : item.ContentDocument.LatestPublishedVersion.Flag__c}">
                                        <aura:if
                                            isTrue="{!if(v.namespace=='',item.ContentDocument.LatestPublishedVersion.Flag__c=='Flag',item.ContentDocument.LatestPublishedVersion.Flag__c=='Flag')}">
                                            <img class="icon-header" src="{!$Resource.Icon_img + '/icons/green.png'}"
                                                width="30" height="30" title="{!$Label.c.Flag}" />
                                        </aura:if>
                                        <aura:if
                                            isTrue="{!if(v.namespace=='',item.ContentDocument.LatestPublishedVersion.Flag__c=='Non Flag',item.ContentDocument.LatestPublishedVersion.Flag__c=='Non Flag')}">
                                            <img class="icon-header" src="{!$Resource.Icon_img + '/icons/orange.png'}"
                                                width="30" height="30" title="{!$Label.c.Non_Flag}" />
                                        </aura:if>
                                        <aura:if
                                            isTrue="{!if(v.namespace=='',item.ContentDocument.LatestPublishedVersion.Flag__c=='Archive',item.ContentDocument.LatestPublishedVersion.Flag__c=='Archive')}">
                                            <img class="icon-header" src="{!$Resource.Icon_img + '/icons/red.png'}"
                                                width="30" height="30" title="{!$Label.c.Archive}" />
                                        </aura:if>
                                    </div>
                                </td>
                                <td scope="row">
                                    <ui:outputText value="{!item.ContentDocument.Owner.Name}" />
                                </td>
                                <td scope="row">
                                    <lightning:formattedDateTime value="{!item.ContentDocument.LastModifiedDate}"
                                        year="numeric" month="numeric" day="numeric" hour="2-digit" minute="2-digit"
                                        timeZone="{!$Locale.timezone}" />
                                </td>
                                <td scope="row">
                                    {!item.Size}
                                </td>
                                <td scope="row">
                                    <aura:if
                                        isTrue="{!if(v.namespace=='',item.ContentDocument.LatestPublishedVersion.KB_Article__c==true,item.ContentDocument.LatestPublishedVersion.KB_Article__c==true)}">
                                        <div class="slds-form-element">
                                            <div class="slds-form-element__control">
                                                <div class="slds-checkbox">
                                                    <input type="checkbox" name="options" id="checkbox-44"
                                                        value="checkbox-44" checked="true" disabled="true" />
                                                    <label class="slds-checkbox__label" for="checkbox-44">
                                                        <span class="slds-checkbox_faux"></span>
                                                    </label>
                                                </div>
                                            </div>
                                        </div>
                                        <aura:set attribute="else">
                                            <lightning:input type="checkbox" name="KBArticle" Checked="false"
                                                disabled="true" />
                                        </aura:set>
                                    </aura:if>
                                </td>
                            </tr>
                        </aura:if>
                    </aura:iteration>
                </tbody>
            </table>
        </div>
    </div>

CSS:

.THIS .slds-table_bordered {
   table-layout: unset;
   width: 100%;
   border-collapse: collapse;
 }
 .THIS .header th {
   border-left: 1px solid #d0d0d0;
   padding: 8px;
   border-bottom: 1px solid #d0d0d0;
   text-align: -webkit-center;
 }
 .THIS .body tr {
   border-bottom: 1px;
 }
 .THIS .panel {
   width: 100%;
   overflow-y: hidden;
 }
 .THIS .body_panel {
   display: inline-block;    
   height: 61vh;
   overflow-x: hidden;
 }
 .THIS .body td {
   border-left: 1px solid #d0d0d0;
   padding: 8px;
   text-align: -webkit-center;
 }
 .THIS ::-webkit-scrollbar {
     width: 6px;
     height:6px;
 }

My Requirement:- we want display to the notifications without reloading the page and with out any streaming api. if any change happen on the record from custom lightning page.
I have done some R&D. then i found something like PlatformEvents and empApi Components. I tried two scenario's Created One platform Event Object. 1)Publishing the notification from Process Builder and able to get notifications in Bell Icon. 2)Publishing the Notification from process builder.For Subscribing the event, created lightning component with help "empAPI component" and added my component to a lightning page, then i can able to see the notification in cosnole. But if add the same component into Lightning Application, not able to see the notifications.
i guess event not subscribing, little confusing. Below is the code snippet.
Component:-

Controller:-
({ init : function(component, event, helper) { alert('init() calling');
var empApi = component.find("empApi"); var errorHandler = function (message) { console.log("Received error ", message); }.bind(this); empApi.onError(errorHandler);
var channel='/event/Custom_Notification__e'; var sub; var replayId=-1;
var callback = function (message) { component.find('notifLib').showToast({ "title": "Message Received!", "message": message.data.payload.Notification_Title__c });
console.log("Notification Title>>>>>>" + message.data.payload.Notification_Title__c); }.bind(this); empApi.subscribe(channel, replayId, callback).then(function(value) { console.log("Subscribed to channel " + channel); sub = value; component.set("v.sub", sub); }); } })

Lightning App:-

<aura:application extends="force:slds">
     <aura:dependency resource="markup://force:*" type="EVENT"/>
     <c:PESubscribe2/>    
</aura:application>

Could you please help any one.
Thanks
Hi Folks,

As per Spring 19 we can send  custom notification using Process Builder. any one have an idea how the  notifcation wokring in back end?

I have done POC for standard fucntionality bell icon its wokring fine. But the same should be in Lightning Page.

Requirement :-  first i have to create bell icon in Lightning Component and have to send the notificaton to the same.

Thanks in advance.
Ragavendra
Hi Folks,

Am quite new to Lightning and trying to understand Events so far i have created two components making Parent Child compoent with help of Events. But getting "Action failed: c:MySampleChildCmp$controller$handleClick [Cannot read property 'setParams' of null] Failing descriptor: {c:MySampleChildCmp$controller$handleClick}"
Unable to identify the Error.

Here is  the code.

ChildToParentEvent.evt:-

<aura:event type="COMPONENT">
    <aura:attribute type="String" name="firstName"/>
    <aura:attribute type="String" name="lastName"/>
    <aura:attribute type="String" name="Phone"/>
</aura:event>

MySampleChildCmp:- 
<aura:component>
    <!--<aura:attribute type="String" name="userData" default=""/>
    <aura:attribute type="String" name="firstName" default=""/>
    <aura:attribute type="String" name="lastname" default=""/>
    <aura:attribute name="Phone" type="Integer" default=""/>-->
    <aura:registerEvent name="ChildToParentEvnt" type="c:ChildToParent"/>
    <lightning:button variant="brand" label="Brand action" title="Brand action" onclick="{! c.handleClick }" />
</aura:component>

MySampleChildCmpController:- 
({
    handleClick : function(component, event, helper) {
        alert('called Child component');        
        var evt = component.getEvent("c.ChildToParentEvnt");
        evt.setParams({'firstName' : SFDC,
                        'lastName' : Developer,
                        'Phone' : 9999999
                       });
            evt.fire();
        alert('called Event');
    }
})

MySampleParentCmp:-
<aura:component >
    <aura:attribute type="String" name="userData" default="" />
    <aura:attribute type="String" name="firstName" default="ABC" />
    <aura:attribute type="String" name="lastName" default="DEF" />
    <aura:attribute type="Integer" name="Phone" default="" />
    <aura:attribute type="boolean" name="callChild" default="false" />
    <aura:handler name="ChildToParentEvnt" event="c:ChildToParent" action="{!c.handleClick}"/>
        <div>
           <c:MySampleChildCmp />
    </div>
    <div>
        <h2>User Data from Event </h2>
        Name    : {!firstName} {!lastName}<br/><br/>
        Phone    : {!Phone}
    </div>
</aura:component>

MySampleParentController:-

({
    handleClick : function(component, event, helper) {
        alert('Called Parent');
        var lastName= event.getParam('lastName');
        var firstName= event.getParam('firstName');
        var Phone= event.getParam('Phone');
        component.set('v.lastName', lastName);
        component.set('v.firstName', firstName);
        component.set('v.phone', Phone);
    }
})


Thanks in Advance,
Ragav
Need DML update details in trigger or apex.
if any field is updated? is there way to find that DML update happened from either manual or Data Loader or some other API.

Requirement:- If I update any field manually, do not want to update the same field from data loader or some other API.
I am facing couple of challenges with Dynamic SOSL.
Records are available with "test.abc1@test.digital or test.abc@test.com" and "(123) 456-7890"(based on locale).

we are using Dynamic SOSL query with multiple search terms and asterisk match (*)

Email field not working with :-

1)searchTerm ="@test.digital*"
2)searchTerm ="abc1*"
3)searchTerm ="abc1@test.digital*" or searchTerm =".abc1@test.digital*"

Phone number not working with :-

1)searchTerm ="890*"
2)searchTerm ="23)4*"
3)searchTerm ="67890*"

***We ant fetch records with any character from email field and any number from Phone number field.*** 

we tried multiple ways suggested by salesforce i.e. 
https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_sosl_find.htm

Code :-
SearchCaseByMultipleId(string searchText){
        String searchTerms = '(';
        for(string str : searchText.split(',')){
            if(str.length()>0){
               searchTerms  = searchTerms+' "' +str +'*'+'" '+'OR';
            }else{                
            }           
        }
        searchTerms = searchTerms.removeEnd('OR');
        searchTerms = searchTerms+')';
       string finalQuery = 'FIND :searchTerms IN ALL FIELDS RETURNING '+objectName+'(' + quryFields +' 
         ORDER BY CreatedDate DESC NULLS last)';
       list<list<Sobject>> results = search.query(finalQuery);
}
search term looks like :- ("@test.digital*" OR "abc1*").

is there any other way for my requirement or is something missing? 

My Requirement:- we want display to the notifications without reloading the page and with out any streaming api. if any change happen on the record from custom lightning page.
I have done some R&D. then i found something like PlatformEvents and empApi Components. I tried two scenario's Created One platform Event Object. 1)Publishing the notification from Process Builder and able to get notifications in Bell Icon. 2)Publishing the Notification from process builder.For Subscribing the event, created lightning component with help "empAPI component" and added my component to a lightning page, then i can able to see the notification in cosnole. But if add the same component into Lightning Application, not able to see the notifications.
i guess event not subscribing, little confusing. Below is the code snippet.
Component:-

Controller:-
({ init : function(component, event, helper) { alert('init() calling');
var empApi = component.find("empApi"); var errorHandler = function (message) { console.log("Received error ", message); }.bind(this); empApi.onError(errorHandler);
var channel='/event/Custom_Notification__e'; var sub; var replayId=-1;
var callback = function (message) { component.find('notifLib').showToast({ "title": "Message Received!", "message": message.data.payload.Notification_Title__c });
console.log("Notification Title>>>>>>" + message.data.payload.Notification_Title__c); }.bind(this); empApi.subscribe(channel, replayId, callback).then(function(value) { console.log("Subscribed to channel " + channel); sub = value; component.set("v.sub", sub); }); } })

Lightning App:-

<aura:application extends="force:slds">
     <aura:dependency resource="markup://force:*" type="EVENT"/>
     <c:PESubscribe2/>    
</aura:application>

Could you please help any one.
Thanks