• Jerome Lusinchi
  • NEWBIE
  • 265 Points
  • Member since 2014
  • JLUS Consulting

  • Chatter
    Feed
  • 8
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 50
    Replies
Hello, can anyone help me please.
I am using a visualforce page and I want to know,
once I've created and saved a field, can I go to another pages with the information of the page before?
Hello,

I have gone through various discussion forums and salesforce blogs. All of them have explained these terms. But my technical knowledge is bad and i could not understand those.
It would be grateful If any of you can take your time and explain these terms in a detailed way with any example. 

Thank you.
I have been trying to figure out how best to accomplish a certain functionality I want on a custom object page layout, and I have yet to find the answer.  Basically, I have created a standard object called "Seminar", which has a lookup field for Opportunity.  I also want to display the Account and Opportunity Owner on the Opportunity object on the page layout of the Seminar object.  

So far, I have tried to accomplish this two ways.  First, I tried creating a button on the Opportunity page layout for creating new seminars.  This button prepopulates data from the Opportunity into the fields in the Seminar.  Clicking it would could copy the data as follows:

Opportunity Field            Seminar Field
Opportunity                ->    Opportunity lookup
Opportunity.Account     ->    Account lookup
Opportunity.Owner         ->    User lookup        

After doing this, I discovered I was not happy with the results.  Yes, I minimized data entry (one of my goals) but the fields would not update if the parent fields on the opportunity changed.

Looking around, I discovered that a formula might be the best way to accomplish displaying the fields from Opportunity object on the page layout of the Seminar object:

Opportunity Field            Seminar Field
Opportunity                ->    Opportunity lookup
Opportunity.Account     ->    Formula: HYPERLINK("/" & Opportunity__r.Account.Id, Opportunity__r.Account.Name)
Opportunity.Owner        ->    HYPERLINK("/" & Opportunity__r.OwnerId, Opportunity__r.Owner.FirstName & " " & Opportunity__r.Owner.LastName)

After setting this up, I was still unhappy.  I had three issues with the formula approach:

1. I have to create a hyperlink for the formula fields to link back to the objects for those fields. Not a huge deal but kind of a pain.
2. I can no longer use related list functionality on the account page because it is a formula field and not a lookup.
3. I no longer get the hover tooltip that displays additional information about the related object that I would get from a lookup field when users hover over the link.

Anyway, for a tl;dr, my question is:

Is there any way to display fields that are on a parent/related object in the child page layout such that the child fields automatically populate/update when there are changes to the parent object, while also being able to utilize related lists and the hover tooltip?
Hello,

I've created a trigger to count Tasks related to an Opportunity.  The trigger fires when a Task is inserted, updated, or deleted and works as expected. I would like to schedule a nightly update that on Tasks with a certain Subject that will refresh the counts on the Opportunity  I created the class below from SFDC documentation, but I'm unclear on how to include the scheduled run time and how to implement it.  Can anyone help!
 
global class RenewalTasksDaily implements Schedulable {
   global void execute(SchedulableContext ctx) {
      CronTrigger ct = [SELECT Id, CronExpression, TimesTriggered, NextFireTime
                		FROM CronTrigger
                		WHERE Id = :ctx.getTriggerId()];

      System.debug(ct.CronExpression);
      System.debug(ct.TimesTriggered);

      ClassRenewalTaskCount TC = new ClassRenewalTaskCount();
      TC.taskCount(Trigger.new);
   }
}

 

I have a custom object which is a child to the Opportunity object. The custom object is viewed via visualforce page. Sometimes Users need to create payment records for the child object. This is achieved by calling a method on a controller extension. When pressed, the method will automatically create detail records using information in the custom object record. 

I am trying to write a test class that will check the controller is working correctly and that the values copied over from the custom object are correct. I can't figure out how to call the method to create the payments. Can anyone help? 

Here is the test class: 

@isTest                 
public class sipExt_Test {
    public static testMethod void testSIPExtController() {
        
    // Create Opportunity from test utilities class
    List<Opportunity> OppList = testUtilities.createTestOpps(1); 

    // Create the SIP
    bonus_calculator__c bc1 = new bonus_calculator__c(opportunity__c = OppList[0].Id);
    insert bc1;    
        
    PageReference ref = new PageReference('/apex/SIP2?id=' + bc1.Id);
    Test.setCurrentPage(ref);
        
    // Create SIP standard controller, pass it the SIP Record
    ApexPages.StandardController controller = new ApexPages.StandardController(bc1);
        
    // Pass the Controller to the Extension
    sipExt stdController = new sipExt(controller); 
        
    stdController.createPayments();           
  
    // Query for Payments fields
    List <Bonus_Payments__c> bPayList = [SELECT Id FROM Bonus_Payments__c WHERE Bonus_Record__c = :bc1.Id];    
        
        system.debug(bPayList[0].id);                
        
    }
}

  • December 12, 2014
  • Like
  • 0
Hi All,

when i insert record in Metadata_brand__c object, automatically record should insert in Metadata_campaign__c. for that i have written trigger please check. i am stuck in the lookup fields value passing. please anyone can help me. this is trigger
 
trigger BrandTrigger on METADATA_Brand__c (after insert, after delete, after undelete,  before delete,after update, before insert, before update) {
  TACTHelper.setStatus();
  
  List<Metadata_Campaign__c> NewCampaign= new list<Metadata_Campaign__c>();
  
  List<Metadata_Program__c> Program= [select id,name from Metadata_Program__c where Program_ID__c='54'];
  
  List<METADATA_Therapy_Class__c> therapy=[select id,name from METADATA_Therapy_Class__c where Therapy_Class_ID__c='6'];
   
   for(METADATA_Brand__c brand : Trigger.new){
   	
  Metadata_Campaign__c camp= new Metadata_Campaign__c();
  
    camp.Name=brand.Name;
    camp.Program__c=Program.Id;  // I stucked here.
    camp.Therapy_Class__c=therapy.Id; // i stucked here.
    camp.Campaign_Type__c='CIC';
    camp.Description__c=brand.Name + 'CIC General Information';
    camp.Metadata_Status__c='A';
    camp.DISPLAY_FLAG__c='Y';
    camp.Branded__c='Yes';
    camp.USMM__c='No';
    camp.HCP__c='No' ;	
  	Newcampaign.add(camp);
  }
   insert NewCampaign;
  }

 // there is no relationship with each objects. how can i achieve this.

Error Message:System.StringException: Invalid id: Program.Id: Trigger.BrandTrigger: line 15, column 1 
Hi,

Under Data.com Administration i don't see new beat feature Duplicate Managment, what could be the problem?

Hello,

I am trying to create a test class for a security check class.  I am using a SOQL query to get an account and pass that along to the class.  When I do a Run Test in the sandbox, it give me the following error:

System.QueryException: List has no rows for assignment to SObject
Class.SecurityCheckTest.securityCheckTest: line 32, column 1

I believe this is telling me that the query is not returning any data to put into the "acct" attribute.  But I have put a "where id != NULL" on the query.  Can anyone give me a suggestion as to why I would still be getting this error?

Line 32 -  

acct = [select id,name,ownerId,BillingAddress,ShippingAddress,Billing_Address__c,Shipping_Address__c,BillingStreet ,BillingCity,BillingState,BillingPostalCode,BillingCountry,
                                    ShippingStreet,ShippingCity,ShippingState,ShippingPostalCode,ShippingCountry,CreatedBy.name,lastModifiedBy.name ,CreatedDate,createdby.id,lastmodifiedby.id,
                                    lastmodifieddate,Ultimate_Parent_Owner_ID__c,lastActivityDate,account_availability__c,Account_Link__c,Account_Hierarchy_Link__c
                                    from account where id != NULL limit 1];
Test Class -
@isTest
private class SecurityCheckTest {

    static testMethod void securityCheckTest() {
      
      boolean showing;
      User runThis = [Select id, alias, email, username, userRoleId, ProfileId From User Where userRoleId != NULL limit 1];
      system.debug('runThis user ==> ' + runThis);
      
      Account acct = new Account();
      acct = [select id,name,ownerId,BillingAddress,ShippingAddress,Billing_Address__c,Shipping_Address__c,BillingStreet ,BillingCity,BillingState,BillingPostalCode,BillingCountry,
                                    ShippingStreet,ShippingCity,ShippingState,ShippingPostalCode,ShippingCountry,CreatedBy.name,lastModifiedBy.name ,CreatedDate,createdby.id,lastmodifiedby.id,
                                    lastmodifieddate,Ultimate_Parent_Owner_ID__c,lastActivityDate,account_availability__c,Account_Link__c,Account_Hierarchy_Link__c
                                    from account where id != NULL limit 1];
    insert acct;  // is this necessary?
        
        system.debug('acct id ==> ' + acct.id);
        system.debug('Name ==> '+ acct.Name);
        system.debug('UPO ID ==> ' + acct.Ultimate_Parent_Owner_ID__c);
        if(acct!=NULL){
      SecurityCheck sec = new SecurityCheck(acct);
      system.debug('acct ==> ' + acct);
      system.debug('currRecord ==> ' + sec.currRecord);
      system.RunAs(runThis){
        showing = sec.showPage();
      }
        } else { system.debug('==> Account is empty'); }
    
    
    system.debug('showing ==> ' + showing);
    }
}
Thanks for any help that you can give.
Hello, can anyone help me please.
I am using a visualforce page and I want to know,
once I've created and saved a field, can I go to another pages with the information of the page before?
global class ClosePosEveryDay implements database.Batchable<sObject>{
 global database.QueryLocator start(database.BatchableContext bc){
    String query;
    date todayDate=date.today();
    System.debug('Today Date------------->'+todayDate);
    System.debug('System Date------------->'+System.today());
    query='select id,Status__c from position__c where Status__c=\'Closed\' and createdDate<=:(todayDate)+1';
    System.debug('Query------------->'+query);
    return Database.getQueryLocator(query);
    }
    global void execute(database.BatchableContext bc, List<position__c> scope){
    System.debug('Scope------------->'+scope);
    for(position__c posRec:scope){
    posRec.Status__c='Closed';
   
    }
    Database.update(scope,false);
    }
    global void finish(database.BatchableContext bc){
    }
    }
please give me valid answer for this.
Hello

I have three scheduled jobs chained, one of them must be scheduled only if it`s the first day of the month.

This way:

Update all the Accounts, ten Accounts at a time managing a custom setting to re-schedule Account update job from the last Id processed, when the last Account is processed, then custom setting is updated to null and begin Update Contacts job...

Update Contact job is identical to Update Account Job, including the same custom setting to divide the execution in ten Contacts execution and then..

I have if (today.day == 1) then schedule a third job which updates Products, when its finished Account update job is scheduled to the next day

else (a different day than 1) I schedule Account update job to the next day and previously, custom setting is updated to null.


Well, there was a mistake in this code (I didnt do it :) ) because in the case its day 1, i dont update to null the custom setting so next day Contact job will begin to process from the last processed day 1, but this is not the problem I want to solve, although I can discard it`s related to my main issue.

Last, but not least, the code executes inside try-catch, sending an email in case of exception.

Well, my problem began at January 1st, from that day to day 15, execution of Contact jobs processed more or less 500 records(over a total of 30000) and then stopped, WITHOUT updating the custom setting causing the next day the first contact processed was the last processed the previous day. Day one were processed the contacts of index 1 to 500, second day 500 to 1000, third day 1000 to 1234, cause there are 1234 contacts at all, where the implementation is supposed to process every Contact every day.

What I really can`t understand and makes me go crazy is that in case of any error, updating custom setting, contact, null lists, whatever, an email is supposed to be sent to me and there was no email sent so there was not error or (crazy) there was an email error each day from January 1st to January 15th

Any ideas would be apreciated, and, yes, next time I`ll look for a better solution than chained jobs.

Regards and happy new year everybody
I have been into Siebel for 7yrs & planning to move into SFDC.The tutorials online are basic and not enough.
I have a free trial,what is best way I can learn SFDC to mark a career in any organization considering my experience.
Please suggest how to move on,the steps to start of with,the forums to follow,the online tutorials that can help.
Any help will be greatly useful.

Thanks in Advance
 
  • January 20, 2015
  • Like
  • 0
Hello,

I have gone through various discussion forums and salesforce blogs. All of them have explained these terms. But my technical knowledge is bad and i could not understand those.
It would be grateful If any of you can take your time and explain these terms in a detailed way with any example. 

Thank you.
Please help me regarding this validation , 
in the phone field we could enter only 10 digit not more or less than 10 digit and not contain any chanracter and i have created a validation which is as follow but in this there is a problem if we enter a number like 1234567891as then it not showing any error and for every condition it is perfect, please help me.
my validation is:
IF (not(isblank(Phone)),OR(NOT(REGEX(Phone , "\\D*?(\\d\\D*?){10}")), NOT(ISNUMBER(Phone))),NULL)
I'm taking the records that meet the criteria in the list & then I'm updating the field

List<Object1__c> lstOfObject = [ SELECT Id, Object__c, Rule_Evaluation_Criteria__c, Status__c, (SELECT Id, Object2__r.Name,                      Object2__r.Object__c, Object2__r.Field__c, Object2__r.Operator__c, Object2__r.Value__c FROM Object1_Object2_JO__r), (SELECT Id, Object3__r.Rule_Name__c, Object3__r.Object_Name__c, Object3__r.Field_to_Update__c, Object3__r.Value_to_Update__c FROM Object1_Object2_JO__r) FROM Object1__c WHERE Object__c = 'Contact' AND Rule_Evaluation_Criteria__c = 'Record is Created' AND Status__c = 'Active' ];

This is the query that I'm using to get the records using the junction objects I've created a code if else condition to match the criteria that is entered
Once the criteria is met a field will be update so this is the code I'm using to update the field

for(Object1_Object3_JO__c objObject1Object3JO : objObject1.objObject1Object3JO __r)
{
if(isInCriteria==True)
{
a.put(objObject1Object3JO.Object3__r.Field_to_Update__c,objObject1Object3JO.Object3__r.Value_to_Update__c);
}
}

objObject1Object3JO.Object3__r.Field_to_Update__c
This variable stores the name of the field to update

objObject1Object3JO.Object3__r.Value_to_Update__c
This variable stores the value to assign to that field

I need the assign the Field that is stored in (objObject1Object3JO.Object3__r.Field_to_Update__c) the value that i have save in (objObject1Object3JO.Object3__r.Value_to_Update__c)

Please help me in achieve this
Thanks in advance
my user is deleting Opportunities even though, he doesn't have access for Opportunity on profile level and Permission set level, how he is deleting records?
Im trying to create a apex class for all my unpaid invoices... 

anyone know why im getting this error? thanksUser-added image
I have been trying to figure out how best to accomplish a certain functionality I want on a custom object page layout, and I have yet to find the answer.  Basically, I have created a standard object called "Seminar", which has a lookup field for Opportunity.  I also want to display the Account and Opportunity Owner on the Opportunity object on the page layout of the Seminar object.  

So far, I have tried to accomplish this two ways.  First, I tried creating a button on the Opportunity page layout for creating new seminars.  This button prepopulates data from the Opportunity into the fields in the Seminar.  Clicking it would could copy the data as follows:

Opportunity Field            Seminar Field
Opportunity                ->    Opportunity lookup
Opportunity.Account     ->    Account lookup
Opportunity.Owner         ->    User lookup        

After doing this, I discovered I was not happy with the results.  Yes, I minimized data entry (one of my goals) but the fields would not update if the parent fields on the opportunity changed.

Looking around, I discovered that a formula might be the best way to accomplish displaying the fields from Opportunity object on the page layout of the Seminar object:

Opportunity Field            Seminar Field
Opportunity                ->    Opportunity lookup
Opportunity.Account     ->    Formula: HYPERLINK("/" & Opportunity__r.Account.Id, Opportunity__r.Account.Name)
Opportunity.Owner        ->    HYPERLINK("/" & Opportunity__r.OwnerId, Opportunity__r.Owner.FirstName & " " & Opportunity__r.Owner.LastName)

After setting this up, I was still unhappy.  I had three issues with the formula approach:

1. I have to create a hyperlink for the formula fields to link back to the objects for those fields. Not a huge deal but kind of a pain.
2. I can no longer use related list functionality on the account page because it is a formula field and not a lookup.
3. I no longer get the hover tooltip that displays additional information about the related object that I would get from a lookup field when users hover over the link.

Anyway, for a tl;dr, my question is:

Is there any way to display fields that are on a parent/related object in the child page layout such that the child fields automatically populate/update when there are changes to the parent object, while also being able to utilize related lists and the hover tooltip?
At one shot how to update the contract owner as same as account owner
I'm trying to schedule a couple of Apex Classes to run weekly.

When I attempt this in our "Sandbox" environment I can go to Develop > Apex Classes > Schedule Apex and the available Apex Classes appear but when I try this in the "Live" environment no Apex Classes are available to schedule (they appear in the Apex Classes section but do not appear in the Schedule Apex section)

The message returned says
No records found due to one of the following:
  • There are no records of this type
  • You don't have permission to see any of the records

I have admin rights and I've tried to schedule them using our other admin users login details but with no luck.

Is this a problem with my access rights (and how do get the necessary access rights) or is there something obvious that I'm missing?

Many thanks

Alec
Hello,

I've created a trigger to count Tasks related to an Opportunity.  The trigger fires when a Task is inserted, updated, or deleted and works as expected. I would like to schedule a nightly update that on Tasks with a certain Subject that will refresh the counts on the Opportunity  I created the class below from SFDC documentation, but I'm unclear on how to include the scheduled run time and how to implement it.  Can anyone help!
 
global class RenewalTasksDaily implements Schedulable {
   global void execute(SchedulableContext ctx) {
      CronTrigger ct = [SELECT Id, CronExpression, TimesTriggered, NextFireTime
                		FROM CronTrigger
                		WHERE Id = :ctx.getTriggerId()];

      System.debug(ct.CronExpression);
      System.debug(ct.TimesTriggered);

      ClassRenewalTaskCount TC = new ClassRenewalTaskCount();
      TC.taskCount(Trigger.new);
   }
}

 
The page gets redirect to the standard view when I am trying to refresh a account record detail page in the Agent Console using the following javascript code(js written in a page which is bind in a section on the standard detail page).

var currentURL =  "/{!Account.Id}"; 
top.location.href = currentURL;

As the top url is "https://cs7.salesforce.com/ui/desktop/DesktopPage" so i am trying with the following js code
parent.location.href = "/{!Account.Id}?srPos=0&srKp=001";

But i am getting the following error message:-

"Unsafe JavaScript attempt to initiate navigation for frame with URL 'https://cs7.salesforce.com/001M000000fp1k2?srPos=0&srKp=001&isdtp=mn' from frame with URL 'https://c.cs7.visual.force.com/servlet/servlet.Integration?lid=066C0000000QSDM&ic=1&isdtp=mn'. The frame attempting navigation is neither same-origin with the target, nor is it the target's parent or opener."

Can anybody tell me to auto refresh a detail page using javascript in the Agent Console.

 
I am trying to mark a date when picklist value is changed to a certain value to that date.

IF(ISPICKVAL(Application_Status__c , "Accept"), TODAY(), NULL)

but issue is since the formula is evaluating to true daily it is changing this date field to today that is if I change to Accept today the date is today tomorrow it is changing to 18th and day after it is changing back to 19th instead I want it to be 17th. Can some one guide me. 

we dont have ISchanged function in formulas
Hi,

We have a Visualforce page which should display a Report for the Current case. I tried to create a Report based on the Case Id but the filter doesnt show Case Id(i.e. Case Record Id). Is there any possiblity to include Case Id in filter criteria?

Thanks.
Hello i am trying to show Custom Related list from a Custom Object in a visualforce page that is in a community. I believe i have everything right but the fields are not showing or retreiving anything for the last two page blocks here is my code

<apex:page controller="CommunityProjectController" showHeader="false" sidebar="false">
    <apex:composition template="CommunityPageTemplate">
    <apex:define name="bodyContent">
    <apex:form >
        <apex:pageBlock >
       
        
        <apex:pageBlockTable value="{!thisProject}" var="item" columns="6">
            <apex:column headerValue="Project Name">
                <apex:outputLink value="/apex/SMBCommunityProject?Projectid={!item.id}">{!item.Name}</apex:outputLink>
            </apex:column>
            <apex:column value="{!item.Area__c}"/>
            
            <apex:column value="{!item.Project_Sub_Class__c}"/>
            <apex:column value="{!item.Status__c}"/>
            <apex:column value="{!item.Technical_Lead__c}"/>
            <apex:column value="{!item.Primary_Contact__c}"/>
        </apex:pageBlockTable>
        </apex:pageBlock>
       
        <apex:pageBlock >
        <apex:pageBlockTable value="{!thisProject}" var="item" columns="5">
            
            <apex:column value="{!item.Budget__c}"/>
            <apex:column value="{!item.Contingency__c}"/>
            <apex:column value="{!item.Total_Budget__c}"/>
            <apex:column value="{!item.Total_Invoiced__c}"/>
            <apex:column value="{!item.Budget_Remaining__c}"/>
        </apex:pageBlockTable>
        </apex:pageblock>
        
        <apex:pageBlock >
        <apex:pageBlockTable value="{!invoices}" var="item" columns="6">
            <apex:column >
                <apex:outputLink value="/apex//apex/printableinvoice?id={!item.id}" >{!item.Name}</apex:outputLink>
            </apex:column>
            <apex:column value="{!item.Invoice_Date__c}"/>
            
            <apex:column value="{!item.Payment_Terms__c}"/>
            <apex:column value="{!item.Invoice_Due_Date__c}"/>
            <apex:column value="{!item.Invoice_Total__c}"/>
            <apex:column value="{!item.Status__c}"/>
            <apex:column value="{!item.Project__c}"/>
        </apex:pageBlockTable>
        </apex:pageBlock>

        

        <apex:pageBlock >
        <apex:pageBlockTable value="{!changeOrders}" var="item" columns="6">
            <apex:column value="{!item.name}" />
            <apex:column value="{!item.Status__c}"/>
            <apex:column value="{!item.Amount__c}"/>
            <apex:column value="{!item.Date_Requested__c}"/>
            <apex:column value="{!item.Date_Approved__c}"/>
            <apex:column value="{!item.Approval_Method__c}"/>
        </apex:pageBlockTable>
        

       
            
        </apex:pageBlock>
    
    </apex:form>

    </apex:define>
    </apex:composition>

</apex:page>

--------------------------------------------------------------------------------------------------------------------------------------
/*
    This class will handle grabbing a passed in projectid as a url parameter, then display the info
*/
public with sharing class CommunityProjectController{

    public Project__c thisProject {get;set;}
    public List<Change_Order__c> changeOrders {get;set;}
    public List<Invoice__c> invoices {get;set;}
    public String thisProjectId {get;set;}

    public CommunityProjectController()
    {
    
        //get our projectId parameter, use it to query for our project and set it to "thisProject"
        thisProjectId = ApexPages.currentPage().getParameters().get('projectId');

        thisProject = [SELECT id, name, Area__c, Project_Sub_Class__c, Status__c, Technical_Lead__c, Primary_Contact__c, 
                        Budget__c, Contingency__c, Total_Budget__c, Total_Invoiced__c, Budget_Remaining__c FROM Project__c WHERE id =: thisProjectId];
         
      
        
        changeOrders = [SELECT id, Name, Status__c, Amount__c, Date_Requested__C, Date_Approved__c, Approval_Method__c FROM Change_Order__c WHERE id =:thisProjectId];

        for(Change_Order__c currentChangeOrder : changeOrders)
        {

        }

        invoices = [SELECT id, Name, Invoice_Date__c, Payment_Terms__c, Invoice_Due_Date__c, Invoice_Total__c, Status__c, Project__c FROM Invoice__c WHERE id =: thisProjectId];

        for(Invoice__c currentInvoice : invoices)
        {

        }

        
    }

}