• pjaenick.ax736
  • NEWBIE
  • 40 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 16
    Questions
  • 27
    Replies
Have a working javascript button.  Now I'd like to avoid pushing it :)

So I've utilized the other suggestions I've found and embedded my script in a VF page, but having trouble making the class "schedulable":
global class calljavascript_cls implements Schedulable {

    global string callfunc{get;set;}

    global void execute(SchedulableContext sc) {
        calljavascript_cls();
    }

    @future(callout=true)
    public static void calljavascript_cls() {
        callfunc='<script> func(); </script>';
    }
}

Error: Compile Error: Variable does not exist: callfunc at line 14 column 9

Thanks for any assistance,
Pete
I have a trigger that needs to fire on before insert, after insert, before update and after update conditions -
 - Each invokes a different class method.
 - The before triggers (insert and update) fire on the affected record(s)
 - The after triggers (insert and update) fire on record(s) of a different object

There is also workflows that perform field updates.  But only want the update triggers to fire for existing records. 

The solutions I've seen (thus far) would work for a "before insert" vs "before update" condition, and similarly work for an "after insert" vs "after update" condition.

How do I prevent the before update and after update triggers from firing on an insert record?
Keep in mind, if the before update trigger (correctly) fires, I DO want the after update trigger to also fire.

Thanks for any strategies / guidance.
I'm trying to insert multiple records with many field assignments - mostly all the same with only one field that distinguishes one record from the next, in other words:

<my_obejct__c> mo;

            if (some_condition) {
                mo = new my_object__c(field1__c = 1, field2__c = 'test', field3__c = 'banana', field4__c = 3.14, field5__c = variableA);
                mosToInsert.add(mo);
            }
            if (some_condition2) {
                mo = new my_object__c(field1__c = 1, field2__c = 'test', field3__c = 'banana', field4__c = 3.14, field5__c = variableB);
                mosToInsert.add(mo);
            }
            if (some_condition3) {
                mo = new my_object__c(field1__c = 1, field2__c = 'test', field3__c = 'banana', field4__c = 3.14, field5__c = variableC);
                mosToInsert.add(mo);
            }
            if (mosToInsert.size>0) insert mosToInsert;

Any way to define a "baseline" record for fields 1-4 and avoid all the repeated field assignments?

Thanks,
Pete
Is there a way to combine these two statements?  If there is, I haven't been able to get the syntax right :

            Case newCase = new case();
            insertCaseAndAttachEmail(newCase, email);

Thanks for any assistance !
Pete
 
I'm trying to display the record 'name' field (auto-numbered field) on a visualforce page after insert

How can I do that?  Do I really need to re-query for it to display it after insert?

Here's my page & controller class :
--------------------------------------------------------
<apex:page standardController="MyCustomObject__c" extensions="MyCustomObjectExt">

    <apex:form >
        <apex:outputPanel id="all">
            <apex:sectionHeader title="My Custom Object" subtitle="{!MyCustomObject__c.Name}"/>  <!-- 'Name' is always null :(  -->
            <apex:outputPanel >
                <apex:commandButton action="{!SaveButton}" value="Save Me!" status="SaveButtonStatus" rerender="all"/>
            </apex:outputPanel>
        </apex:outputpanel>
    </apex:form>
</apex:page>

--------------------------------------------------------
public class MyCustomObjectExt {

    private MyCustomObject__c thisRecord;
    private ApexPages.StandardController sc = null;

    public MyCustomObjectExt(ApexPages.StandardController sc) {
        this.sc=sc;
        thisRecord = (MyCustomObject__c) sc.getRecord();
    }

    public PageReference saveButton() {
        try {
            Upsert thisRecord;
            string s = '/' + ('' + thisRecord.get('Id'));
        } catch (Exception e){
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Whoops !'));
        }
        return null;
    }
}

Thank you!
Relatively new to VF - begging some guidance please :

I have a custom obj that relates to itself (contact call logs, can relate one call to a prior)

If the user (on call (C)) selects to associate prior call (B) that itself has a prior call (A), logic should take then associate (C) to (A).  (A)'s id is inserted into the lookup field of record (C).  This works fine.

What doesn't work is when (B) has no prior call.  I get a "System.TypeException: Invalid id value for this SObject type"

Here's the VF page section where I'm passing both the "ParentTo" and "ParentsParent" id's :
(can I do the null check right here in the VF page and pass a single value?)

<apex:commandButton value="Associate" action="{!Associate}" rerender="all”>
    <apex:param name="Parent" value="{!prior.id}" assignTo="{!Parent}"/>
    <apex:param name="ParentsParent" value="{!prior.First_call__c}" assignTo="{!ParentsParent}"/>
</apex:commandButton>

Controller excerpt:
91        if(ParentsParent != null) {
92            call__c ParentCall = new call__c(id=ParentsParent);

Line [92] produces the error, even though (I thought) the null-check should have avoided this line entirely.

Thanks for any assistance

Greetings!

 

If I have a list of existing records that I wish to query for existence based on Field1, Field2, and Field3, how would I ensure that I don't get a record back where List[1].Field1 matches record X, but List[1].Field2 matches some other record?

 

       ExistingContactsList=[
            SELECT Name, Email, Phone, AccountId
              FROM contact
             WHERE Name in:setNames and Email in:setEmails and Phone in:setPhones and AccountId in:setAccountIds 
            ];

 

Thanks for any help,

Pete

Is it possible to define one method within a "with sharing" class as "without sharing"?  If so, what's the correct syntax? 

 

"Error: Compile Error: Methods cannot be marked with(out) sharing"

 

I'd rather not turn off the "with sharing" clause for the entire class.

 

Thanks

Hi !

 

I have this trigger to send e-mail based on the field "e_mail__c":

 

trigger Email_EnviodeLayout_AR on Task (after update) {
    
  List<Id> TaskMap = new List<Id>();
    for(Task tsk : [select e_mail__c, subject, link_do_ar__c, status from Task])
    {
        if(tsk.subject == 'AR - Envio do primeiro layout' && tsk.status == 'Concluído')
        {        
	        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
	        String[] toAddresses = new String[] {tsk.e_mail__c};
	        mail.setToAddresses(toAddresses);
	        mail.setSubject('Duomind');
	        String template = 'Hello {0}, \nYour task has been modified. Here are the details - \n\n';
	        template+= 'Veja suas fotos clicando aqui - {1}\n';   
	            
	        List<String> args = new List<String>();
	        args.add(tsk.link_do_ar__c);
	       
	        // Here's the String.format() call.
	        String formattedHtml = String.format(template, args);
	       
	        mail.setPlainTextBody(formattedHtml);
	        Messaging.SendEmail(new Messaging.SingleEmailMessage[] {mail});
	    }
    }
}

 But It's giving me this error:

 

  • Email_EnviodeLayout_AR: execution of AfterUpdate caused by: System.EmailException: SendEmail failed. First exception on row 0; first error: NO_MASS_MAIL_PERMISSION, Single email is not enabled for your organization or profile. Single email must be enabled for you to use this feature.: [] Trigger.Email_EnviodeLayout_AR: line 22, column 1

Greetings Listers,

 

Within an Apex class, I'm looping through and building a string thusly :

 

  mystring += eachrecord.Quantity__c + '         ' + eachrecord.Item__c + '\n';

 

After setting the target field to this value, when displaying this value in a report (or an alert), the whitespace between the Quantity and Item values is compressed to a single space.  How can I prevent this?

 

Thanks,

Pete

Hi,

Am unable to refresh any of the resources in the IDE from the server.

When am trying to refresh a page from the web, getting an Exception saying:

 

 

Unable to refresh resource 'MileaeExension.cls':
com.salesforce.ide.api.metadata.types.Metadata$JaxbAccessorF_fullName cannot be cast to com.sun.xml.bind.v2.runtime.reflect.Accessor

 

Unable to refresh resource 'MileaeExension.cls':


com.salesforce.ide.api.metadata.types.Metadata$JaxbAccessorF_fullName cannot be cast to com.sun.xml.bind.v2.runtime.reflect.Accessor

 

Please assist to rectify the issue. 

 

Thanks in advance,

VNath