• Titis Wulandari
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 5
    Replies
Marquee Component:
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" controller="Marquee">
    <!-- Attributes -->
    <aura:attribute name="txt" type="String" />
    <!-- Initializer -->
    <aura:handler name="init" action="{!c.doInit}" value="{!this}"/>
    <div class="marquee" >
        <p>
            {!v.txt}
        </p>
    </div>
</aura:component>

Controller js:
({
    doInit : function(component, event, helper) {
        helper.callApexMethod(component,helper);
        window.setInterval(
            $A.getCallback(function() {
                helper.callApexMethod(component,helper);
            }), 60000
        );
    }
})

Component Helper js:
({
    callApexMethod : function(component, event, helper) {
        var data = component.get('c.cobaData');
        data.setCallback(this, function(response) {
            var state = response.getState();
            if (state === "SUCCESS" && response.getReturnValue()!=null) {
                component.set('v.txt', response.getReturnValue());
                setTimeout(
                  $A.getCallback(function(response) {
                    var spanSelector = document.querySelectorAll('.marquee p'),
                    i;            
                    var MarqueeSpeed = parseInt($A.get("$Label.c.MarqueeSpeed"));
                        
                    for (i = 0; i < spanSelector.length; i++) {
                        var spanLength = spanSelector[i].offsetWidth,
                          timeTaken = spanLength / MarqueeSpeed;
                        spanSelector[i].style.animationDuration = timeTaken + "s";
                    }
                  }), 1000);
            }
        });     
        $A.enqueueAction(data);
    },
})

Apex class:
public class Marquee {
    @AuraEnabled
    public static string cobaData(){
        Integer counter = 0;
        id id1 = UserInfo.getUserId();
        id profileid = UserInfo.getProfileId();
        
        id roleCheck = UserInfo.getUserRoleId();
        String roleid = 'no role';
        if(roleCheck != null){
            roleid = roleCheck;
        }
        
        Datetime thisday = System.Datetime.now();
        String text;
        String Subject, allSubject = ' ';
        String groupId = 'no group';
        String checkRole, checkProfil, checkGroup;
        
        List<GroupMember> check_group = [Select groupId From GroupMember Where UserOrGroupId =: id1];
        if(check_group != null){
            for(GroupMember check : check_group){
                groupId = check_group.isEmpty() ? 'no group' : check.groupId;
            }
        }
        
        List<Marquee__c> marquee = [SELECT Id, Name, Category__c, Content__c, Start_Date_Time__c, End_Date_Time__c, Is_Active__c, RoleIds__c, ProfileIds__c, PublicGroupIds__c FROM Marquee__c Where Start_Date_Time__c <= :thisday AND End_Date_Time__c >= :thisday order by CreatedDate desc];
        
        if(marquee != null){
            if(!marquee.isEmpty()){
                for(Marquee__c acc : marquee){
                    checkRole = acc.RoleIds__c == null ? 'no filter' : acc.RoleIds__c == '' ? 'no filter' : acc.RoleIds__c;
                    checkProfil = acc.ProfileIds__c == null ? 'no filter' : acc.ProfileIds__c == '' ? 'no filter' : acc.ProfileIds__c;
                    checkGroup = acc.PublicGroupIds__c == null ? 'no filter' : acc.PublicGroupIds__c == '' ? 'no filter' : acc.PublicGroupIds__c;
                    
                    if(checkRole.contains(roleid) || checkProfil.contains(profileid) || checkGroup.contains(groupId)){
                        counter++;
                        Subject = ' ' +system.label.NotificationsSeparator + ' ' +counter +'. ' +acc.Content__c;
                        allSubject = allSubject + Subject;
                    }
                }
            }
        } else{
            text = (system.label.MarqueeGreetings).replace('user_name',UserInfo.getName());
        }
        if(counter == 0){
            text = (system.label.MarqueeGreetings).replace('user_name',UserInfo.getName());
        }else if(counter == 1){
            String notif = system.label.MarqueeGreetings1;
            notif = notif.replaceall('user_name',UserInfo.getName());      
            notif = notif.replaceall('_notifications_',allSubject);            
            text = notif;
        }else{
            String Multinotif = system.label.MarqueeGreetings2;
            Multinotif = Multinotif.replace('notification_number',string.valueOf(counter));    
            Multinotif = Multinotif.replaceall('user_name',UserInfo.getName());
            Multinotif = Multinotif.replaceall('_notifications_',allSubject);      
            text = Multinotif;
        }
        return text;
    }
}
Hey guys,

Simple formula question. I'm trying to take a date field and return a year and month.

In my flow, I'm trying to make a Get Records criteria:

Due_Date__c - Equals - (This month and year formula). 

I currently have: DATE(YEAR(TODAY()),MONTH(TODAY()),1)

And it seems to be returning: March 1st, 2019. Rather than March 2019. 

Thanks,

Nick
I have a custom Date/Time field that when a value is entered, I would like a formula checkbox to be checked if the date/time is before 7am or after 6pm.

I have not found a way to reference Business Hours. Is there a formula I could use to make this happen? I found one online, but it's not working: 

AND(
VALUE( MID( TEXT( <custom_date_time__c> - 6 ), 12, 2 ) ) >= 7,
VALUE( MID( TEXT( <custom_date_time__c> - 6 ), 12, 2 ) ) <= 18
)

The "- 6" refers to the number of hours my time is behint GMT. Any suggestions?
Hi, I am trying to create a roll up summary based on a related list from a custom object. However, the related list does not show up as an option in the "summarized object" drop down so I am not able to move forward in creating this custom field. Do you have any recommendations as to how to resolve this issue? Thanks!
MAKE SURE THE LOOKUP FIELDS TO THE CONTACT HAVE FILTERS!!!  RECORD TYPE = EMPLOYEE / EMPLOYEE STATUS = ACTIVE
 this is the lookup field.User-added image this is the filter i created but it is not working please suggest me how to solve this.


User-added imagethanks in advance