• Dea73
  • NEWBIE
  • 80 Points
  • Member since 2009

  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 18
    Questions
  • 38
    Replies
Should each trigger that pertains to a specific Object have their own test class? or should there be 1 test class that cover ALL the triggers in an Org.
 
  • January 24, 2017
  • Like
  • 0
I have a cutom button on an object and it's supposed to execute a javascript code.
But today it seems like it doesn't want to work. It just doesn't do anything, it seems like it's not connecting to SF.

Has this happened to anyone else before, and how do you fix it?

Thanks!
  • February 12, 2015
  • Like
  • 0
What possible issues can a Junction object to itself create? For example: when you have an Object called Project and you want to be able to link a Parent Project to a Child Project and vice versa.
I created the junction with lookups, i've seen where it saus that you can create the a junction with master-detail relationships.
Thanks!!
  • November 20, 2014
  • Like
  • 0

All,

 

I have created a visualforce page that overrides the view layout of a custom object.

For new button in a related list in the visualforce page i wrote a script for it to take the user to a recordtype selection page.

 

/setup/ui/recordtypeselect.jsp?ent=01I30000001mHL0&retURL=%2F{!Maintenance_Window__c.Id}&save_new_url=%2Fa04%2Fe%3FCF00N30000009pOlA%3D{!Maintenance_Window__c.Name}%26CF00N30000009pOlA_lkid%3D{!Maintenance_Window__c.Id}%26retURL%3D%252F{!Maintenance_Window__c.Id}

 

It works for me, I'm system administrator, but it doesn't work for other profiles.

 

Any ideas or suggestions,

 

Thanks in advance

  • July 05, 2012
  • Like
  • 0

Hi All,

 

Not sure why my validation rule is not working.

Can someone let me know what i'm missing???

I'm trying to validate that when a picklist is changed to the option " feasible - progress" it is changed by a specific user.

 

ISPICKVAL( Order_Status__c ,"Feasible – In Progress") &&

ISCHANGED( Order_Status__c )  &&

$User.Id <> '00530000000ybRJ'

 

 

Thanks,

  • March 29, 2012
  • Like
  • 0

Hi All,

 

Can someone help me figure out what the problem is with the update unit test?

I'm trying to see if my trigger will pass the 200 mark :)

 

static testmethod void test_CircuitHandling(){ 
    
    List<Circuits__c> newckts = new List<Circuits__c>();
    for(integer i=0; i<=199; i++ ){
     
     newckts.add(new Circuits__c(Circuit_Status__c = 'Pending', RecordTypeId = '01230000000LSN1AAO'));
     
      
     
    }
    Database.Saveresult[] results = Database.insert(newckts);
    System.assertEquals(results.size(), 200);
    
    Set<Id> Ids = new Set<Id>();
    for(Circuits__c ckts : newckts){
     
     Ids.add(ckts.Id);
    }
    List<Circuits__c> upList = [select Circuit_Status__c, Id From Circuits__c Where Id =: Ids];
    List<Circuits__c> updList = new List<Circuits__c>();
    for(Circuits__c cktList: upList){
     cktList.Circuit_Status__c = 'Active';
     cktList.Service_Start_Date__c = system.today();
        updList.add(cktList);
     
    }
    if(!updList.isEmpty()){
    Database.Saveresult[] upResults = Database.update(updList); 
    }
    
   }

 

Thanks in advance,

 

 

 

  • October 25, 2011
  • Like
  • 0

I've been trying to figure out how to test this part of a trigger for the longest. Because Eclipse tells mee that part of the code has not been tested.

 

Can someone help me please????

 

for (Circuits__cthisCircuit : replaceList){

 

if(thisCircuit.Disconnect_Type__c == 'Change')

{

thisCircuit.Circuit_Status__c = 'Disco Changed';

thisCircuit.Disconnect_Date__c = c.Service_Start_Date__c-1 ;

}

 

}

updatereplaceList;

 

  • August 11, 2011
  • Like
  • 0

Why is this a malformed query?

 

SELECT Id, Circuit_ID__c
FROM Circuits__c
WHERE Z_Location_LU__c IN (Select (Select Location_Name__c From Demarcation__r where id = 'a08Q0000003xSVy') From Location__c l)

 

Thanks for the help!

  • July 11, 2011
  • Like
  • 0

I have a an extension controller and a test class

 

When i run the test class everything is fine and when i try to deploy the test class it tells me my constructor is not defined. Can someone help me please????

Thanks in advance.

 

Here is my class

public class newWorkOrderWizardController {
 
 private final Work_Order__c workObj;
 
 
 public newWorkOrderWizardController(ApexPages.StandardController stdController) {
        this.workObj = (Work_Order__c)stdController.getRecord();
    }
 
       
 
 
 Work_Order__c workorder {get{if(workorder == null) workorder = new Work_Order__c();
                return workorder;}set;}
 

 
 Work_on_Circuit__c woc {get{if(woc == null)     woc = new Work_on_Circuit__c();
                return woc;}set;}
  
public List<circuitWrapper> circuitList { get; set; }
public PageReference step2(){
        return Page.displaycircuits;
}
public PageReference stepBack(){
        return Page.createWorkOrder;
    }
    public PageReference cancel(){
   
        PageReference woPage = new PageReference('/a05/o');
        woPage.setRedirect(true);
        return woPage;

    }
   
    
 public List<circuitWrapper> getCircuits() {
        if(circuitList == null) {circuitList = new List<circuitWrapper>();
         
   for(Circuits__c ckt : [select Id,Name, Circuit_ID__c,Service_Level__c, Circuit_Status__c,

Circuits__c.RecordType.Name from Circuits__c where
(Circuits__c.A_CPE_Location_LU__c =: workorder.CPE_Location__c and
Circuits__c.Circuit_Status__c IN ('Active') and
Circuits__c.RecordType.Name  IN ('Customer Circuit')) or
(Circuits__c.Z_Location_LU__c =: workorder.Location__c  and
Circuits__c.RecordType.Name  IN ('Off-Net Circuit') and
Circuits__c.Circuit_Status__c IN ('Active'))Order By Circuits__C.RecordType.Name ]){
  
     
                circuitList.add(new circuitWrapper(ckt));
}

}return circuitList;
}


        public PageReference save(){
               
        insert workorder;
       
        List<Circuits__c> selectedCircuits = new List<Circuits__c>();
       
        for(circuitWrapper cCkt : getCircuits()) {
            if(cCkt.selected == true){
               
                selectedCircuits.add(cCkt.skt);
            }
           
        }
           
        List<Work_on_Circuit__c> newWorkOnCircuits = new List<Work_on_Circuit__c>();
        for(Circuits__c ckt:selectedCircuits){
           
                newWorkOnCircuits.add(new Work_on_Circuit__c(Circuit__c = ckt.id, Work_Order__c = workorder.id));
           
        }
        insert newWorkOnCircuits;
       
        PageReference woPage = new ApexPages.StandardController(workorder).view();
        woPage.setRedirect(true);
        return woPage;
    } 

public class circuitWrapper{
   
public Circuits__c skt {get;set;}
public Boolean selected {get;set;}

public circuitWrapper(Circuits__c ckt){
   
skt = ckt;
selected = false;  
   
}  
}

 

}

 

 

 

 

Here is the test class

@isTest

private class WorkOrderTest {
 
 static testmethod void WorkOrdertest(){
 Location__c newloc = new Location__c(Name='Test Location', Svc_State__c = 'GA');
 insert newloc;
 
 Location__c newloc2 = new Location__c(Name='Test Location2', Svc_State__c = 'GA');
 insert newloc2;
 
 Location__c newloc3 = new Location__c(Name='Test Location3', Svc_State__c = 'GA');
 insert newloc3;
 
 Location__c newloc4 = new Location__c(Name='Test Location4', Svc_State__c = 'GA');
 insert newloc4;
 
 CPE_Location__c  cpe1 = new CPE_Location__c(Name='cpeloc1', Location_Name__c = newloc.id);
 insert cpe1;
 
 CPE_Location__c  cpe2 = new CPE_Location__c(Name='cpeloc2', Location_Name__c = newloc2.id);
 insert cpe2;
 
 CPE_Location__c  cpe3 = new CPE_Location__c(Name='cpeloc3', Location_Name__c = newloc3.id);
 insert cpe3;
 
 CPE_Location__c  cpe4 = new CPE_Location__c(Name='cpeloc4', Location_Name__c = newloc4.id);
 insert cpe4;
 
 Order__c order1 = new Order__c(A_Location__c=newloc.id, A_CPE_Location__c=cpe1.id,Z_Location__c=newloc2.id,

Z_CPE_Location__c=cpe2.id );
 insert order1;
 
 order__c order2 = new Order__c(A_Location__c=newloc3.id, A_CPE_Location__c=cpe3.id,Z_Location__c=newloc4.id,

Z_CPE_Location__c=cpe4.id );
 insert order2;
 
 Circuits__c ckt1 = new Circuits__c(Order__c=order1.id,

A_Location_LU__c=newloc.id,Z_Location_LU__c=newloc2.id,A_CPE_Location_LU__c=cpe1.id,Z_CPE_Location_LU__c=cpe2.id);
 insert ckt1;
 
 
 Circuits__c ckt2 = new Circuits__c(Order__c=order2.id,

A_Location_LU__c=newloc3.id,Z_Location_LU__c=newloc4.id,A_CPE_Location_LU__c=cpe3.id,Z_CPE_Location_LU__c=cpe4.id);
 insert ckt2;
 
 Circuits__c ckt3 = new Circuits__c(Order__c=order1.id,

A_Location_LU__c=newloc.id,Z_Location_LU__c=newloc2.id,A_CPE_Location_LU__c=cpe1.id,Z_CPE_Location_LU__c=cpe2.id);
 insert ckt3;
 
 
 Circuits__c offckt1 = new Circuits__c(Order__c=order1.id,

A_Location_LU__c=newloc.id,Z_Location_LU__c=newloc2.id,A_CPE_Location_LU__c=cpe1.id,Z_CPE_Location_LU__c=cpe2.id,Sup

ports_Customer_Circuit__c=ckt1.id);
 insert offckt1;
 
 Circuits__c offckt2 = new Circuits__c(Order__c=order1.id,

A_Location_LU__c=newloc3.id,Z_Location_LU__c=newloc4.id,A_CPE_Location_LU__c=cpe3.id,Z_CPE_Location_LU__c=cpe4.id,Su

pports_Customer_Circuit__c=ckt2.id);
 insert offckt2;
 
 //PageReference pageRef = Page.success;
 //Test.setCurrentPage(pageRef);
 Work_Order__c wrkorder = new Work_Order__c();
 ApexPages.StandardController sc = new ApexPages.StandardController(wrkorder);
 newWorkOrderWizardController controller = new newWorkOrderWizardController(sc);
 
 
    wrkorder.Work_Order_Type__c ='Copper to Off-Net Wavelength';
    wrkorder.Work_Order_Type__c = 'Roll';
    wrkorder.CPE_Location__c = cpe1.id;
    wrkorder.Location__c = newloc3.id;
  
  
    
   controller.cancel();
   controller.stepBack();
   controller.step2();
   controller.save();
 
 
 
 }
 
 
 
 

 

 

}

  • June 16, 2011
  • Like
  • 0

Hi all,

 

Can someone help me figure this out please!!!

 

I have a master detail relationship between cases and a custom object called affected circuits.

Because of custom data display issues, i had to recreate the case view detail page as a visualforce page.

 

I manage to display affected circuits as a related list on the VF page.

Everything work fine, except the new button where you create a 'lineitem' in the affected circuits page.

 

below is the controller extension that i created, where i have a page refernce with the URL and parameters to go to the insertpage when the button is clicked.

 

Can anyone help me figure out why it's not working or is there anothe rway of doing this???

 

public with sharing class AffectedCircuitsExtension {
       
    
        private final Case afc;
       // private final Affected_Circuits__c cafc;
    
       
        public AffectedCircuitsExtension(ApexPages.StandardController stdController) {
   
    //Id id = ApexPages.currentPage().getParameters().get('id');
        this.afc = (Case)stdController.getRecord();
       
    }
   
   
   
 public Circuits__c[] getOffCircuits() {
   
   
    
    Circuits__c[] offnet = [Select Id, Circuit_ID__c
                            From Circuits__c
                            WHERE Supports_Customer_Circuit__c IN (Select Circuits__c                
                                                                   FROM Affected_Circuits__c
                                                                   WHERE Case__c = :afc.Id)
                           ORDER BY Id];
     return offnet;                              
           }
      
     public PageReference NewAffectedCircuits()
     {
        PageReference NewAFCPage = new

PageReference('/a0Y/e?CF00NQ0000000gCYj=afc.Id&CF00NQ0000000gCYj_lkid=afc.Id&retURL=%2Fafc.Id&saveURL=%2Fafc.Id');
        newAFCPage.setRedirect(true);
        return newAFCPage;
     
     }  

}

 

 

Thanks

  • May 18, 2011
  • Like
  • 0

Hi all,

 

I'm getting the hang of writting a unit test for triggers. But now i'm wondering how to do it for a class.

 

I have the class below, which is a wrapper class. How on earth do i write a unit test for it?

Any help would be greatly appreciated!!!!

 

public class newWorkOrderWizardController {


private final Work_Order__c workOrderObj;

public newWorkOrderWizardController(ApexPages.StandardController controller) {
  this.workOrderObj = (Work_Order__c)controller.getRecord();
 

}
   
Work_Order__c workorder;
Work_on_Circuit__c woc;

public Work_Order__c getWorkOrder(){
if(workorder == null) workorder = new Work_Order__c();
return workorder;
}

public Work_on_Circuit__c getWorkonCircuit(){
if(woc == null) woc = new Work_on_Circuit__c();
return woc;
}


public PageReference step2(){

return Page.displaycircuits;

}


public PageReference stepBack(){

return Page.createWorkOrder;

}

public PageReference cancel() {
    PageReference workorderPage = new PageReference('/a05/o');
    workorderPage.setRedirect(true);
    return workorderPage;
    }

 

public List<circuitWrapper> circuitList{get;set;}
public List<offCircuitWrapper> offCircuitList{get;set;}

public List<circuitWrapper> getCircuits(){
   ID idcpe = workorder.CPE_Location__c;
   
   if(circuitList == null){
   circuitList = new List<circuitWrapper>();
  
   for(Circuits__c ckt : [select Id,Name, Circuit_ID__c,Service_Level__c,Circuit_Status__c from Circuits__c where Circuits__c.A_CPE_Location_LU__c =: idcpe]){
  
      circuitList.add(new circuitWrapper(ckt));
   }
  }   return circuitList;
   
}

 

public List<offCircuitWrapper> getOffCircuits(){
   ID idlocation = workorder.Location__c;
  
   if(offCircuitList == null){
   offCircuitList = new List<offCircuitWrapper>();
  
   for(Circuits__c ockt : [Select c.Service_Level__c, c.Name, c.Id, c.Circuit_Status__c, c.Circuit_ID__c From Circuits__c c where RecordTypeId = '01230000000LSRd' and Circuit_Status__c = 'Active' and Z_Location_LU__c =: idlocation]){
  
      offCircuitList.add(new offCircuitWrapper(ockt));
   }
  }   return offCircuitList;
   
}


public class circuitWrapper{

public Circuits__c ckt{get;set;}
public Boolean selected{get;set;}

public circuitWrapper(Circuits__c c){

 ckt = c;
 selected = false;

}
}

public class offCircuitWrapper{

public Circuits__c ockt{get;set;}
public Boolean oselected{get;set;}

public offCircuitWrapper(Circuits__c offc){

 ockt = offc;
 oselected = false;

}
}

 


public PageReference save(){

// create work order
insert workorder;


  
List<Circuits__c> selectedCircuits = new List<Circuits__c>();
  
     for(circuitWrapper cktwrapper : getCircuits()){
      if(cktwrapper.selected == true){
          selectedCircuits.add(cktwrapper.ckt);
      }
  }
 
  for(Circuits__c ckt : selectedCircuits){
   Work_on_Circuit__c ckts = New Work_on_Circuit__c(Circuit__c = ckt.id, Work_Order__c = workorder.id);
   insert ckts;
     
  }


List<Circuits__c> selectedOffCircuits = new List<Circuits__c>();
  
     for(offCircuitWrapper ocktwrapper : getOffCircuits()){
      if(ocktwrapper.oselected == true){
          selectedOffCircuits.add(ocktwrapper.ockt);
      }
  }
   
for(Circuits__c ockt : selectedOffCircuits){
   Work_on_Circuit__c ockts = New Work_on_Circuit__c(Circuit__c = ockt.id, Work_Order__c = workorder.id);
   insert ockts;
     
  }
 
 PageReference woPage = new ApexPages.StandardController(workorder).view();
      woPage.setRedirect(true);

      return woPage;
 
  
  
  
}  

 

  • April 18, 2011
  • Like
  • 0

i'm trying to insert  case comments into related cases when the parent case inserts a new case comment and the public checkbox is checked.

For some reason only 1 related case gets a new case comment inserted eventhough there are 2.

Can someone help me PLEASE!!!! Thanks in advance!!!

 

trigger updateComment on CaseComment (after insert, after update)

{

Set<Id> parentCase=new Set<Id>();

Case> mapCase=new Map<Id,Case>(); Case> lstCase=[Select Id,ParentId From Case Where ParentId in :parentCase];

Map<Id,

for(CaseComment t: Trigger.new)

{

parentCase.add(t.ParentId);

}

 

List<

for(case c :lstCase)

{

mapCase.put(c.ParentId,c);

}

 

for(CaseComment t: Trigger.new)

{

 CaseComment[] addCom = new CaseComment[0];

for(Case target : mapCase.values()){

if(mapCase.containsKey(t.ParentId) && t.isPublished == TRUE)

new CaseComment(CommentBody=t.CommentBody, ParentId=mapCase.get(t.ParentId).id, isPublished=TRUE));

 

}

insert addCom;

 }

 

 

}

 

}

 

}

 

  • March 27, 2011
  • Like
  • 0

Hi,

 

I hope someone can answer this question.

Because of page layout issues i had to create a VF page to override a custom object View Page.

I also used the new inline editting feature for VF, which works like a charm.

 

But when i create a view list, i'm not able to to inline edit.

Why is this???? And is there a work around :smileymad:

 

Thanks in advance!!

  • March 25, 2011
  • Like
  • 0

Below is a SOQL where i try to retrieve information from my parent object (in a master detail relationship) where circuits (master) is the parent and Work_on_Circuit is my child (detail).

 

The error i'm getting is :

junctionCircuits Compile Error: The inner select field 'Circuit__r.id' cannot have more than one level of relationships at line 16 column 38 

<script type="text/javascript">// var tabId = getCookie('dmTab'); var closeButtonId = 'thePage:theForm:closeButton'; if (tabId && getBottomPanelHeight() > 28) { showCloseButton(closeButtonId, true); } else { showCloseButton(closeButtonId, false); } function showHideControllerExtensionTabs() { var controllerTab = document.getElementById('thePage:theForm:controllerTab'); if (typeof(controllerTab) != 'undefined' && controllerTab !== null) { controllerTab.style.display = (false) ? 'inline' : 'none'; } document.getElementById('thePage:theForm:extensionTabGroup').style.display = (true) ? 'inline' : 'none'; } // </script>

 

[select Id, Name,Circuit_ID__c, Circuit_Status__c from Circuits__c where Id IN (select Circuit__r.id from Work_on_Circuit__c where Work_on_Circuit__c.Work_Order__c =: woid)]

 

How am i supposed to get the Id ??

  • February 01, 2011
  • Like
  • 0

Hi,

 

I have an Object A that has a many to many relationship to Object B.

Because of this i have created junction Object C

I have created a wizard that makes it possible to select 3 object B.

 

In my controller extension I'm able to create a new instance of Object A along with the 3 selected instances of Object B correctly populated ( as lookup fields)

How do i retrieve the ids of the lookup fields to create 3 seperate instances of the junction object????

  • January 27, 2011
  • Like
  • 0

Below is my VF code and the controller code.

When i hit the command button i get this white page and it says AN INTERNAL ERROR HAS OCCURRED.

 

Can't figure out, why this is happening, help please!!!!

 

<apex:page controller="workOrderController">
<apex:form >
<apex:pageBlock mode="maindetail" >
<apex:pageBlockSection columns="1" title="Number of Orders Involved">
<apex:actionRegion >
<apex:outputText value="Number of Orders Involved:"/>
<apex:selectList value="{!involved}" size="1">
<apex:selectOption itemValue="0" itemLabel="0"/>
<apex:selectOption itemValue="1" itemLabel="1"/>
<apex:selectOption itemValue="2" itemLabel="2"/>
<apex:selectOption itemValue="3" itemLabel="3"/>
<apex:actionSupport event="onchange" reRender="selection" status="status5" />
</apex:selectList>
</apex:actionRegion>
</apex:pageBlockSection>
<apex:outputPanel id="selection">
<apex:pageBlockSection id="section1" rendered="{!involved==1||involved==2||involved==3}">
<apex:outputLabel value="Order 1:" for="orderNumber1"/>
<apex:inputText id="orderNumber1" value="{!orderNumber1}"/>
</apex:pageBlockSection>
<apex:pageBlockSection id="section2" rendered="{!involved==2||involved==3}">
<apex:outputLabel value="Order 2:" for="orderNumber2"/>
<apex:inputText id="orderNumber2" value="{!orderNumber2}"/>
</apex:pageBlockSection>
<apex:pageBlockSection id="section3" rendered="{!involved==3}" >
<apex:outputLabel value="Order 3: " for="orderNumber3"/>
<apex:inputText id="orderNumber3" value="{!orderNumber3}"/>
</apex:pageBlockSection>
</apex:outputPanel>
<apex:pageBlockButtons >
<apex:commandButton action="{!displayCircuits}" value="Display Circuits"/>
</apex:pageBlockButtons>
</apex:pageBlock>
<apex:pageBlock title="Retrieved Circuit records">
<apex:dataList value="{!queryResult}" var="r">
<apex:outputText value="{!r.Id}" />
<apex:outputText value="{!r.Name}" />
</apex:dataList>
</apex:pageBlock>
</apex:form>
</apex:page>

 

public class workOrderController{


public Integer involved = 0;
public String orderNumber1{get{return orderNumber1;}set{orderNumber1 = value;}}
public String orderNumber2{get{return orderNumber2;}set{orderNumber2 = value;}}
public String orderNumber3{get{return orderNumber1;}set{orderNumber1 = value;}}
public List<Circuits__c> queryResult{get{return queryResult;} set{queryResult = value;}}
 
public Integer getInvolved(){

 return this.involved;
}


public void setInvolved(Integer involved){

    this.involved = involved;
}


public pageReference displayCircuits(){

String qryString = 'SELECT Id,Circuits__c.Name, Circuits__c.Circuit_ID__c'+
                     'FROM Circuits__c' +
                      'WHERE Order__r.Name =: ' +  orderNumber1 + 'or' +
                          'Order__r.Name =: ' + orderNumber2 + 'or'+
                          'Order__r.Name =:' + orderNumber3;
                 
queryResult = Database.query(qryString);                        
 return null;                        

}

}

  • January 05, 2011
  • Like
  • 0

Hi, i'm working on a page in VF that displays summary information of an already existing page.

 

The idea is to select an option from a location lookup field and the information about the selected location is to appear. But to be able to do this i need to pass the id of the selected location to my controller to get the information like a sum of certain fields.

 

Could someone tell my how i can accomplish this? I'm a newbie at this.

 

Thanks in advance.

  • November 18, 2009
  • Like
  • 0

I have read several examples of how to write a test methods but i can't figure out how to write one for mine.

Is there somebody out there that can help me please????

 

Below is a copy of my apex class.

 

public class centralOfficeExtension {
private final Central_Office__c centralObj;

    public centralOfficeExtension(ApexPages.StandardController controller) {
    
    this.centralObj = (Central_Office__c)controller.getRecord();

    }
    
    public Central_Office__c[] getRRRecords() {
    
    ID idnumber = centralObj.Location__c;
     
    Central_Office__c[] racks = [SELECT Central_Office__c.RR_Assignment__c
                                 FROM Central_Office__c
                                 WHERE Central_Office__c.Location__c = :idnumber];
     return racks;                               
    

    
    
    
          }
    
   

}

 

What it is doing is when on a page, retrieve the location Id and then retrieve all the assignments related to that locationID.

 

Thanks in advance for the help, i really need it:)

  • June 08, 2009
  • Like
  • 0
I have a cutom button on an object and it's supposed to execute a javascript code.
But today it seems like it doesn't want to work. It just doesn't do anything, it seems like it's not connecting to SF.

Has this happened to anyone else before, and how do you fix it?

Thanks!
  • February 12, 2015
  • Like
  • 0
What possible issues can a Junction object to itself create? For example: when you have an Object called Project and you want to be able to link a Parent Project to a Child Project and vice versa.
I created the junction with lookups, i've seen where it saus that you can create the a junction with master-detail relationships.
Thanks!!
  • November 20, 2014
  • Like
  • 0
I am having a lookup field for the same object (self lookup)
As per salesforce, we should receive following error if any record tries to make self as a parent or tries to choose any of the child record as a parent.

Hierarchy Constraint Violation
You cannot set a hierarchy field Parent Hotel to point to itself or a child record.

But, I am not getting this error if I am making a circular hierarchy, as described below -
  1. If making same record as parent of any record (record parent of self during edit) , A->A. then getting thsi error. This is good.
   2. If A -> B->A, then It is not giving error.

Could you please help, if there is any configuration for enabling to restrict circular dependency from clild?


Regards,
Anand

Hi All,

 

Not sure why my validation rule is not working.

Can someone let me know what i'm missing???

I'm trying to validate that when a picklist is changed to the option " feasible - progress" it is changed by a specific user.

 

ISPICKVAL( Order_Status__c ,"Feasible – In Progress") &&

ISCHANGED( Order_Status__c )  &&

$User.Id <> '00530000000ybRJ'

 

 

Thanks,

  • March 29, 2012
  • Like
  • 0

Hi All,

 

Can someone help me figure out what the problem is with the update unit test?

I'm trying to see if my trigger will pass the 200 mark :)

 

static testmethod void test_CircuitHandling(){ 
    
    List<Circuits__c> newckts = new List<Circuits__c>();
    for(integer i=0; i<=199; i++ ){
     
     newckts.add(new Circuits__c(Circuit_Status__c = 'Pending', RecordTypeId = '01230000000LSN1AAO'));
     
      
     
    }
    Database.Saveresult[] results = Database.insert(newckts);
    System.assertEquals(results.size(), 200);
    
    Set<Id> Ids = new Set<Id>();
    for(Circuits__c ckts : newckts){
     
     Ids.add(ckts.Id);
    }
    List<Circuits__c> upList = [select Circuit_Status__c, Id From Circuits__c Where Id =: Ids];
    List<Circuits__c> updList = new List<Circuits__c>();
    for(Circuits__c cktList: upList){
     cktList.Circuit_Status__c = 'Active';
     cktList.Service_Start_Date__c = system.today();
        updList.add(cktList);
     
    }
    if(!updList.isEmpty()){
    Database.Saveresult[] upResults = Database.update(updList); 
    }
    
   }

 

Thanks in advance,

 

 

 

  • October 25, 2011
  • Like
  • 0

I've been trying to figure out how to test this part of a trigger for the longest. Because Eclipse tells mee that part of the code has not been tested.

 

Can someone help me please????

 

for (Circuits__cthisCircuit : replaceList){

 

if(thisCircuit.Disconnect_Type__c == 'Change')

{

thisCircuit.Circuit_Status__c = 'Disco Changed';

thisCircuit.Disconnect_Date__c = c.Service_Start_Date__c-1 ;

}

 

}

updatereplaceList;

 

  • August 11, 2011
  • Like
  • 0

Hi all,

 

Can someone help me figure this out please!!!

 

I have a master detail relationship between cases and a custom object called affected circuits.

Because of custom data display issues, i had to recreate the case view detail page as a visualforce page.

 

I manage to display affected circuits as a related list on the VF page.

Everything work fine, except the new button where you create a 'lineitem' in the affected circuits page.

 

below is the controller extension that i created, where i have a page refernce with the URL and parameters to go to the insertpage when the button is clicked.

 

Can anyone help me figure out why it's not working or is there anothe rway of doing this???

 

public with sharing class AffectedCircuitsExtension {
       
    
        private final Case afc;
       // private final Affected_Circuits__c cafc;
    
       
        public AffectedCircuitsExtension(ApexPages.StandardController stdController) {
   
    //Id id = ApexPages.currentPage().getParameters().get('id');
        this.afc = (Case)stdController.getRecord();
       
    }
   
   
   
 public Circuits__c[] getOffCircuits() {
   
   
    
    Circuits__c[] offnet = [Select Id, Circuit_ID__c
                            From Circuits__c
                            WHERE Supports_Customer_Circuit__c IN (Select Circuits__c                
                                                                   FROM Affected_Circuits__c
                                                                   WHERE Case__c = :afc.Id)
                           ORDER BY Id];
     return offnet;                              
           }
      
     public PageReference NewAffectedCircuits()
     {
        PageReference NewAFCPage = new

PageReference('/a0Y/e?CF00NQ0000000gCYj=afc.Id&CF00NQ0000000gCYj_lkid=afc.Id&retURL=%2Fafc.Id&saveURL=%2Fafc.Id');
        newAFCPage.setRedirect(true);
        return newAFCPage;
     
     }  

}

 

 

Thanks

  • May 18, 2011
  • Like
  • 0

Hi all,

 

I'm getting the hang of writting a unit test for triggers. But now i'm wondering how to do it for a class.

 

I have the class below, which is a wrapper class. How on earth do i write a unit test for it?

Any help would be greatly appreciated!!!!

 

public class newWorkOrderWizardController {


private final Work_Order__c workOrderObj;

public newWorkOrderWizardController(ApexPages.StandardController controller) {
  this.workOrderObj = (Work_Order__c)controller.getRecord();
 

}
   
Work_Order__c workorder;
Work_on_Circuit__c woc;

public Work_Order__c getWorkOrder(){
if(workorder == null) workorder = new Work_Order__c();
return workorder;
}

public Work_on_Circuit__c getWorkonCircuit(){
if(woc == null) woc = new Work_on_Circuit__c();
return woc;
}


public PageReference step2(){

return Page.displaycircuits;

}


public PageReference stepBack(){

return Page.createWorkOrder;

}

public PageReference cancel() {
    PageReference workorderPage = new PageReference('/a05/o');
    workorderPage.setRedirect(true);
    return workorderPage;
    }

 

public List<circuitWrapper> circuitList{get;set;}
public List<offCircuitWrapper> offCircuitList{get;set;}

public List<circuitWrapper> getCircuits(){
   ID idcpe = workorder.CPE_Location__c;
   
   if(circuitList == null){
   circuitList = new List<circuitWrapper>();
  
   for(Circuits__c ckt : [select Id,Name, Circuit_ID__c,Service_Level__c,Circuit_Status__c from Circuits__c where Circuits__c.A_CPE_Location_LU__c =: idcpe]){
  
      circuitList.add(new circuitWrapper(ckt));
   }
  }   return circuitList;
   
}

 

public List<offCircuitWrapper> getOffCircuits(){
   ID idlocation = workorder.Location__c;
  
   if(offCircuitList == null){
   offCircuitList = new List<offCircuitWrapper>();
  
   for(Circuits__c ockt : [Select c.Service_Level__c, c.Name, c.Id, c.Circuit_Status__c, c.Circuit_ID__c From Circuits__c c where RecordTypeId = '01230000000LSRd' and Circuit_Status__c = 'Active' and Z_Location_LU__c =: idlocation]){
  
      offCircuitList.add(new offCircuitWrapper(ockt));
   }
  }   return offCircuitList;
   
}


public class circuitWrapper{

public Circuits__c ckt{get;set;}
public Boolean selected{get;set;}

public circuitWrapper(Circuits__c c){

 ckt = c;
 selected = false;

}
}

public class offCircuitWrapper{

public Circuits__c ockt{get;set;}
public Boolean oselected{get;set;}

public offCircuitWrapper(Circuits__c offc){

 ockt = offc;
 oselected = false;

}
}

 


public PageReference save(){

// create work order
insert workorder;


  
List<Circuits__c> selectedCircuits = new List<Circuits__c>();
  
     for(circuitWrapper cktwrapper : getCircuits()){
      if(cktwrapper.selected == true){
          selectedCircuits.add(cktwrapper.ckt);
      }
  }
 
  for(Circuits__c ckt : selectedCircuits){
   Work_on_Circuit__c ckts = New Work_on_Circuit__c(Circuit__c = ckt.id, Work_Order__c = workorder.id);
   insert ckts;
     
  }


List<Circuits__c> selectedOffCircuits = new List<Circuits__c>();
  
     for(offCircuitWrapper ocktwrapper : getOffCircuits()){
      if(ocktwrapper.oselected == true){
          selectedOffCircuits.add(ocktwrapper.ockt);
      }
  }
   
for(Circuits__c ockt : selectedOffCircuits){
   Work_on_Circuit__c ockts = New Work_on_Circuit__c(Circuit__c = ockt.id, Work_Order__c = workorder.id);
   insert ockts;
     
  }
 
 PageReference woPage = new ApexPages.StandardController(workorder).view();
      woPage.setRedirect(true);

      return woPage;
 
  
  
  
}  

 

  • April 18, 2011
  • Like
  • 0

i'm trying to insert  case comments into related cases when the parent case inserts a new case comment and the public checkbox is checked.

For some reason only 1 related case gets a new case comment inserted eventhough there are 2.

Can someone help me PLEASE!!!! Thanks in advance!!!

 

trigger updateComment on CaseComment (after insert, after update)

{

Set<Id> parentCase=new Set<Id>();

Case> mapCase=new Map<Id,Case>(); Case> lstCase=[Select Id,ParentId From Case Where ParentId in :parentCase];

Map<Id,

for(CaseComment t: Trigger.new)

{

parentCase.add(t.ParentId);

}

 

List<

for(case c :lstCase)

{

mapCase.put(c.ParentId,c);

}

 

for(CaseComment t: Trigger.new)

{

 CaseComment[] addCom = new CaseComment[0];

for(Case target : mapCase.values()){

if(mapCase.containsKey(t.ParentId) && t.isPublished == TRUE)

new CaseComment(CommentBody=t.CommentBody, ParentId=mapCase.get(t.ParentId).id, isPublished=TRUE));

 

}

insert addCom;

 }

 

 

}

 

}

 

}

 

  • March 27, 2011
  • Like
  • 0

Hi,

 

I hope someone can answer this question.

Because of page layout issues i had to create a VF page to override a custom object View Page.

I also used the new inline editting feature for VF, which works like a charm.

 

But when i create a view list, i'm not able to to inline edit.

Why is this???? And is there a work around :smileymad:

 

Thanks in advance!!

  • March 25, 2011
  • Like
  • 0
I am using Excel SForce Connector, which is a great tool when compared to what you can't do in SalesForce without it, but what I really need is an SForce Connector for Microsoft Access that would let me bring data down into Access tables directly, and to update SalesForce from Access. 

 

Why do I need this?  I'm doing a lot of prospecting work to find contact names and addresses for a specific group of opportunities (we sell advertising in "guides" and companies with products related to the topic of a guide are our prospects) and then postal mailing them an advertising media kit.

 

To do this I query SalesForce for opportunities, accounts, and contacts. I do my research in Excel and then add or update the information I find about accounts and contacts back into SalesForce.  Then I copy all that information into Access and create a join so I can print letters and labels using my Dymo label printer.  (As far as I know I can't do this latter in SalesForce because:


    • SalesForce won't let me create a report with two joins (grrr), and

    • SalesForce doesn't support my Dymo label printer

    So a Microsoft Access SForce Connector would be a godsend, but it would have to work with Professional Edition.  SalesForce, you've already got 80% of the work done in the Excel Connector; any chance of creating a Microsoft Access SForce Connector?