• Staci Cara
  • NEWBIE
  • 30 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 5
    Replies

Hi,

I would lik to query all validation rules that contain a condition with profiles. Is this possible?

Thanks in advance!

I need to add on a layout a button that deletes/empties certain field-values of the object once it gets clicked. The logic of the deletion is already implemented but now it shall be done via button click. Can anyone help? How do I combine the code with the button?

 

Hello,

I was wondering if there is a way to export some field of Contacts as a Excel template or to create a pdf that looks as a table from excel for as many columns as fields that need to be exported (e.g 20)?

Thank you in advance for your support.

Staci

Hi all,

i am having trouble to figure out how to implement the following: 

- I have an Object, eg. Account, with one field that the user can update anytime. 
- Once a new Object, eg. AccountPlus__c, gets created I want the field from Account to switch to Read-Only, so that no User can edit it anymore.
- The same field also exists in AccountPlus__c and once a record of AccountPlus__c gets created you can change the field only via this record.
- The information of the same field though, shall be transfered to the Account Object an update it (allthough the field is read only, even for the same User that creates the record of AccountPlus__c)

Do you have any Ideas how that could look? I thought of something like a trigger (with/without a Validation Rule).

Thank you in advance!!!
Best regards, Staci

Hi,

I have dificulties to display some fields and their content in a table.  I need to extract some records from an object with their name and their description. With a simple apex: repeat I am getting a list of these infos, means the one beneath the other. What I need is a table that has two rows and two columns. First row has the name of the record, second row contains the according description. If there are more then 2 records, than the "list" should continue beneath. Means one would have multiple tables beneath each other.

Could someone held me with this issue? That's what I have until now, but it is listing my records on the page...

<apex:repeat value="{!SObject__c.record__r}" var="record">
        <table class="table-with-border record-table">
            <tr>
                <th class="record">{!record.Name}</th>
            </tr>
            <tr>
                <td class="table-cell">
                    <apex:outputText styleClass="description" escape="false" value="{!record.description__c}" />
                </td>
            </tr>
        </table>
    </apex:repeat>
 

 

Hi guys, 

I am having this trigger Handler and I want to use a Constructor, which is calling a class that has methods I need to use. 

My problem is that I want to initialize the constructor in the beforeTrigger Method and call a method of the class in the afterTrigger part. 

Means something like this:

public with sharing class SObjectTriggerHandler extends TriggerHandler {
    Class class;

    public override void beforeUpdate() {
           class = new Class((List<SObject>) Trigger.new, (Map<Id,SObject>) Trigger.oldMap);
    }
   

    public override void afterUpdate() {
          if(class != null) {

class.method();

}

    }

But the afterTrigger won't call the method, because class is null. 

I guess it has to do with the notation at the beginning, since I am initializing the constructor in the beforeTrigger, but isn't that so that the beforeTriggers get executed before the AfterTriggers? Shouldn't then the class have a value. 

After the beforeUpdate the class has defently a value and isn't null. 

What am I doing wrong? Could please somebody help me with this issue? It is urgent!

Thank you in advance! 

I urgently need help with a emailing issue. I want to send an E-mail once some fields in user get changed and everything works fine except that when I want to send the Email to 200 people I am getting the error that I am hitting the limits because it is within a loop. I tried to solve it with an extra class that has all the Message and SingeEmailMessage methods that I need and that implements Queueable. Like that I created a queue that is taking all users that shall get the email. But now I am getting the error: System.LimitException: Too many queueable jobs added to the queue: 51
What I had so far without the extra class:

List<Messaging.SingleEmailMessage > msgList = new List<Messaging.SingleEmailMessage>(); 
        EmailTemplate template = [select Id from EmailTemplate where DeveloperName = : 'My_template']; 
        Messaging.SingleEmailMessage emailMsg; 
        for (User u : [SELECT Id, user_field__c FROM User WHERE Id IN: trigger.new]){ 
             if(u.user_field__c != null){ 
                emailMsg = Messaging.renderStoredEmailTemplate(template.id, u.id, null); // Here appears the error caused by the looping of users
                emailMsg.setSaveAsActivity(false);
                emailMsg.setTreatTargetObjectAsRecipient(false); 
                String[] recipients = new String[]{test@hotmail.com};
                emailMsg.setToAddresses(recipients); 
              } msgList.add(mail); 
        } Messaging.sendEmail(msgList);

Like I said, the alternativ way is to put everything in an separate class that implements Queueable and then call the queue after the IF, like this: System.enqueueJob(new SendingEmail(userLst, template.id, null, false, false)); 

I would prefer to have everything in one class, but how can I avoid hitting the gov.limits when calling Message.renderStoredEmailTemplate(). Any ideas how I can make this solution work? 
Thank you in advance!

Hi all, 

I want to send an email template to the user that is saved in the recipient field of Email alert. 
I don't know how to query the user in order to put him into:  mail.setToAddresses(user.email);    or  mail.setTargetObjectId(user.id);
Could please someone help me?

So far I have: Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
EmailTemplate template = [SELECT Id, Name, Body, Subject FROM EmailTemplate WHERE DeveloperName = : 'MyEmailTemplate']; EmailMessage message = [SELECT Id, TextBody, Subject, ToAddress FROM EmailMessage WHERE Subject =: template.subject];
mail.setTemplateId(template.id);
mail.setSubject(template.subject);
mail.setBody(template.body)
//mail.setTargetObjectId(recipient.id);
mail.setToAddresses(message.toAddress); //at this point it would need a user.email that I don't know how to query
mail.saveAsActivity = false;
Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail});

Can please someone help?

Thank you in advance.

 

Hi guys, 

I am struggling to find a solution to my problem. 

I have the case that if the Account Owner changes to a specific User X a custom field with SObject__c records of this account shall be emptied the else case is already coded.

Can someone please help me with this? 

Thank you in advance!!

 

Hi, 

I want to Map a standard field value (Type String e.g. name) of each User (in users), in case it is not null or '',  with a standard SObject.

The DeveloperName of the SObject and the fieldvalue of the User are beeing the connection of these two. means DeveloperName =: user.fieldValue

But in order to refere to every User of users I would need to write this select inside the for loop and that is not a good way of writing a loop. 

How can I map the right name to the right SObject? Could please someone give me a hint? 

I have come to this result so far, but am very unsure if that is a valid solution:

public static boolean methodname (List <User> user, Map)
       Map <String, SObject> resultMap = new Map <String, SObject>();
       SObject so = [SELECT Id FROM SObject];
   
       for(User u : users){
            if(u.Name != null || u.Name != ' ' ){
                resultMap.put(u.name, so);
                   return true;
            }
        }
          return false;
}

 

Thank you in advance. 

Hello,

I was wondering if there is a way to export some field of Contacts as a Excel template or to create a pdf that looks as a table from excel for as many columns as fields that need to be exported (e.g 20)?

Thank you in advance for your support.

Staci

Hi,

I have dificulties to display some fields and their content in a table.  I need to extract some records from an object with their name and their description. With a simple apex: repeat I am getting a list of these infos, means the one beneath the other. What I need is a table that has two rows and two columns. First row has the name of the record, second row contains the according description. If there are more then 2 records, than the "list" should continue beneath. Means one would have multiple tables beneath each other.

Could someone held me with this issue? That's what I have until now, but it is listing my records on the page...

<apex:repeat value="{!SObject__c.record__r}" var="record">
        <table class="table-with-border record-table">
            <tr>
                <th class="record">{!record.Name}</th>
            </tr>
            <tr>
                <td class="table-cell">
                    <apex:outputText styleClass="description" escape="false" value="{!record.description__c}" />
                </td>
            </tr>
        </table>
    </apex:repeat>
 

 

Hi guys, 

I am having this trigger Handler and I want to use a Constructor, which is calling a class that has methods I need to use. 

My problem is that I want to initialize the constructor in the beforeTrigger Method and call a method of the class in the afterTrigger part. 

Means something like this:

public with sharing class SObjectTriggerHandler extends TriggerHandler {
    Class class;

    public override void beforeUpdate() {
           class = new Class((List<SObject>) Trigger.new, (Map<Id,SObject>) Trigger.oldMap);
    }
   

    public override void afterUpdate() {
          if(class != null) {

class.method();

}

    }

But the afterTrigger won't call the method, because class is null. 

I guess it has to do with the notation at the beginning, since I am initializing the constructor in the beforeTrigger, but isn't that so that the beforeTriggers get executed before the AfterTriggers? Shouldn't then the class have a value. 

After the beforeUpdate the class has defently a value and isn't null. 

What am I doing wrong? Could please somebody help me with this issue? It is urgent!

Thank you in advance! 

Hi, 

I want to Map a standard field value (Type String e.g. name) of each User (in users), in case it is not null or '',  with a standard SObject.

The DeveloperName of the SObject and the fieldvalue of the User are beeing the connection of these two. means DeveloperName =: user.fieldValue

But in order to refere to every User of users I would need to write this select inside the for loop and that is not a good way of writing a loop. 

How can I map the right name to the right SObject? Could please someone give me a hint? 

I have come to this result so far, but am very unsure if that is a valid solution:

public static boolean methodname (List <User> user, Map)
       Map <String, SObject> resultMap = new Map <String, SObject>();
       SObject so = [SELECT Id FROM SObject];
   
       for(User u : users){
            if(u.Name != null || u.Name != ' ' ){
                resultMap.put(u.name, so);
                   return true;
            }
        }
          return false;
}

 

Thank you in advance. 

Hi, i have this watermark added to my visualforce PDF but it actually override all my text.
<img src="{!URLFOR($Resource.tran_watermark)}" width="100%" height="100%" style="position:fixed; background-repeat:repeat; left:0cm; top:0cm; z-index:0; display:{!IF(quote.status == 'approved', 'none', '')}"/>


How can i push the watermark (png file) to the back?