• Sam Swann
  • NEWBIE
  • 20 Points
  • Member since 2015

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

I am new to Lightning Component development.
I have a method in my controller.js for validation check.
validateEmptyField : function(component) {
        var cmpValue = component.get("v.value");
        if ($A.util.isEmpty(cmpValue) || $A.util.isUndefined(cmpValue)){
            component.set("v.errors", [{message:"Field cannot be empty. Please enter valid data."}]);
            return false;
        }
        
        return true;
    }
I do have like 8 attributes for the v.value. 
How can I make 7 attributes to have this validation check and not for one field?

I need to extract that field from cmpValue, but I am not sure which default method to call.

Thanks
 

Hi

Can someone help me with sending an email via Apex class?

Scenario:
Recipient: sammypuppy09876@gmail.com
Sender: no_reply@sammypuppy.com
Subject: "User Login Failed" 
Text: "My Custom Text with one field from above user record" 

I did workflow as well to sent out the email, but now I wanted to do same customization via Apex code (learning curve).

Thanks

Hi

I am new to this Single-Sign-on configuration.
I have customized the autogenerated Jit handler Apex class to insert/update the user record as per my requirement. 

While writing a test class for this auto-generated Jit handler class, I am running into some errors. 

Here are the methods I am trying to refer from Jit handler:
 

/*Create User */
global User createUser(Id samlSsoProviderId, Id communityId, Id portalId,
		String federationIdentifier, Map<String, String> attributes, String assertion) {
		User u = new User();
		handleJit(true, u, samlSsoProviderId, communityId, portalId,
			federationIdentifier, attributes, assertion);
		return u;
	}

/*Update User */
global void updateUser(Id userId, Id samlSsoProviderId, Id communityId, Id portalId,
		String federationIdentifier, Map<String, String> attributes, String assertion) {
		User u = [SELECT FirstName, LastName, Phone, Email FROM User WHERE Id=:userId];
		handleJit(false, u, samlSsoProviderId, communityId, portalId,
			federationIdentifier, attributes, assertion);
	}

/*Jit Handler method */
private void handleJit(boolean create, User u, Id samlSsoProviderId, Id communityId, Id portalId, String federationIdentifier, Map<String, String> attributes, String assertion) {
		if(communityId != null) {
			handleUser(create, u, attributes, federationIdentifier, false);
		} else {
			handleUser(create, u, attributes, federationIdentifier, true);
		}
	}

/*HandleUser method*/
// This method has some basic insert and update User fields based on my requirement.

Can someone please help me out writing a test class and methods that call the above methods?

Thanks
Hi,

I was finding this issue so annyoed that I am starting to hate developing code in the Developer Console.
I don't know if this was an issue to everyone OR only to me OR only with Macbook(OS: 10.11.6) OR for whatever the reason.

Issue:
On the Developer conole, when I am trying to using two finger scroll gesture on the trackpad of my Macbook Pro (15" Late 2015) model, the cursor jumps way back to the some 10-15 lines above/below based on which direction I am scrolling.

Developer API Version: 39.0 (Latest at this very moment)

Can someone shed some light on the issue and fix, I would love developing using Developer Console.

Thanks 

 

Hi,

I wanted to remove a user if the user's profile is changed or if I make user inactive. 
Here is the part of code I am working on, which throws me an error:

        EXCEPTION_THROWN [41]|System.ListException: Missing id at index: 0

@future
public static void DeteleFromGroups(Set<Id> userIds){
    Group g=[SELECT Id, DeveloperName from Group Where DeveloperName='Supervisors'];  //Fetching Group 
    List<GroupMember> listGroupMember =new List<GroupMember>();        //Group member instance
    List<User> users=[Select Id, Name, User.Profile.Name, User.IsActive from user Where Id IN :userIds]; //Fetching user
   
    for (User user : users){
        GroupMember gm= new GroupMember(); 
        if((user.Profile.Name != 'Supervisor' && user.IsActive) || (user.Profile.Name == 'Supervisor' && user.IsActive == FALSE)){
                gm.GroupId=g.id;
                gm.UserOrGroupId = user.id;
               	listGroupMember.add(gm);
            }
    }
    
    if(listGroupMember.size() > 0){
        delete listGroupMember;
    	
        //delete listGroupMember[0].UserOrGroupId;
    }
  }

Please help me out in dealing with this.
Thanks!
 

Hi

I am very new to Lightning Development. I am trying to learning developing Lightning components on my own.
I was trying to develop an Input form for Case Object. Now, I wanted to Attach files feature as well to the form at the very bottom.
Once I upload and save the form, a new Case record should be created with attachments in the record detail page.

I have used this to get the Input for upload a file:
 

<lightning:input type="file" label="Attachment" name="file" multiple="true" aura:id = "upButton" accept="image/png, .zip" onchange="{! c.handleFilesChange }"/>
 

Can someone share a simple code for the controller(handleFilesChange) as well as the Server-side class to save the data to Case object.

Thanks!

Hi,

I wanted to remove a user if the user's profile is changed or if I make user inactive. 
Here is the part of code I am working on, which throws me an error:

        EXCEPTION_THROWN [41]|System.ListException: Missing id at index: 0

@future
public static void DeteleFromGroups(Set<Id> userIds){
    Group g=[SELECT Id, DeveloperName from Group Where DeveloperName='Supervisors'];  //Fetching Group 
    List<GroupMember> listGroupMember =new List<GroupMember>();        //Group member instance
    List<User> users=[Select Id, Name, User.Profile.Name, User.IsActive from user Where Id IN :userIds]; //Fetching user
   
    for (User user : users){
        GroupMember gm= new GroupMember(); 
        if((user.Profile.Name != 'Supervisor' && user.IsActive) || (user.Profile.Name == 'Supervisor' && user.IsActive == FALSE)){
                gm.GroupId=g.id;
                gm.UserOrGroupId = user.id;
               	listGroupMember.add(gm);
            }
    }
    
    if(listGroupMember.size() > 0){
        delete listGroupMember;
    	
        //delete listGroupMember[0].UserOrGroupId;
    }
  }

Please help me out in dealing with this.
Thanks!
 

Hi

Can someone help me with sending an email via Apex class?

Scenario:
Recipient: sammypuppy09876@gmail.com
Sender: no_reply@sammypuppy.com
Subject: "User Login Failed" 
Text: "My Custom Text with one field from above user record" 

I did workflow as well to sent out the email, but now I wanted to do same customization via Apex code (learning curve).

Thanks

hai
  I have 20 accounts,for 20 accounts 50k opportunities are there.common field is there in account as well as in opportunity.If  for example if i change a field in account object(Status field) then associated all opportunity status  fields  should change.One Account is having more than 10K opportunities.Can anyone say how can u achieve this with simple code

Thanks 
Sai

Hi

I am new to this Single-Sign-on configuration.
I have customized the autogenerated Jit handler Apex class to insert/update the user record as per my requirement. 

While writing a test class for this auto-generated Jit handler class, I am running into some errors. 

Here are the methods I am trying to refer from Jit handler:
 

/*Create User */
global User createUser(Id samlSsoProviderId, Id communityId, Id portalId,
		String federationIdentifier, Map<String, String> attributes, String assertion) {
		User u = new User();
		handleJit(true, u, samlSsoProviderId, communityId, portalId,
			federationIdentifier, attributes, assertion);
		return u;
	}

/*Update User */
global void updateUser(Id userId, Id samlSsoProviderId, Id communityId, Id portalId,
		String federationIdentifier, Map<String, String> attributes, String assertion) {
		User u = [SELECT FirstName, LastName, Phone, Email FROM User WHERE Id=:userId];
		handleJit(false, u, samlSsoProviderId, communityId, portalId,
			federationIdentifier, attributes, assertion);
	}

/*Jit Handler method */
private void handleJit(boolean create, User u, Id samlSsoProviderId, Id communityId, Id portalId, String federationIdentifier, Map<String, String> attributes, String assertion) {
		if(communityId != null) {
			handleUser(create, u, attributes, federationIdentifier, false);
		} else {
			handleUser(create, u, attributes, federationIdentifier, true);
		}
	}

/*HandleUser method*/
// This method has some basic insert and update User fields based on my requirement.

Can someone please help me out writing a test class and methods that call the above methods?

Thanks
Hi,

I was finding this issue so annyoed that I am starting to hate developing code in the Developer Console.
I don't know if this was an issue to everyone OR only to me OR only with Macbook(OS: 10.11.6) OR for whatever the reason.

Issue:
On the Developer conole, when I am trying to using two finger scroll gesture on the trackpad of my Macbook Pro (15" Late 2015) model, the cursor jumps way back to the some 10-15 lines above/below based on which direction I am scrolling.

Developer API Version: 39.0 (Latest at this very moment)

Can someone shed some light on the issue and fix, I would love developing using Developer Console.

Thanks 

 

Hi,

I wanted to remove a user if the user's profile is changed or if I make user inactive. 
Here is the part of code I am working on, which throws me an error:

        EXCEPTION_THROWN [41]|System.ListException: Missing id at index: 0

@future
public static void DeteleFromGroups(Set<Id> userIds){
    Group g=[SELECT Id, DeveloperName from Group Where DeveloperName='Supervisors'];  //Fetching Group 
    List<GroupMember> listGroupMember =new List<GroupMember>();        //Group member instance
    List<User> users=[Select Id, Name, User.Profile.Name, User.IsActive from user Where Id IN :userIds]; //Fetching user
   
    for (User user : users){
        GroupMember gm= new GroupMember(); 
        if((user.Profile.Name != 'Supervisor' && user.IsActive) || (user.Profile.Name == 'Supervisor' && user.IsActive == FALSE)){
                gm.GroupId=g.id;
                gm.UserOrGroupId = user.id;
               	listGroupMember.add(gm);
            }
    }
    
    if(listGroupMember.size() > 0){
        delete listGroupMember;
    	
        //delete listGroupMember[0].UserOrGroupId;
    }
  }

Please help me out in dealing with this.
Thanks!