• davidjbb
  • NEWBIE
  • 50 Points
  • Member since 2012

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 36
    Questions
  • 44
    Replies
                  for(jbbfc2__MaterialU__c mu :[select jbbfc2__Workorder__c,jbbfc2__Workorder__r.Id, Name,
                  	jbbfc2__Material__r.jbbfc2__ProductCode__c,jbbfc2__Material__r.jbbfc2__UnitPrice__c,jbbfc2__quantity__c
                  	from jbbfc2__MaterialU__c where jbbfc2__Workorder__r.jbbfc2__Status__c ='Closed'])
                  {
              		  
              		  System.debug('Workorder Id' + mu.jbbfc2__Workorder__r.Id);
              		  System.debug('Material' + mu.Name);
              		  
              		  matList.add(mu);
              		  if(muMap.get(mu.jbbfc2__Workorder__r.Id)==null){	
              		  	
                      	muMap.put(mu.jbbfc2__Workorder__r.Id, matList);
              		  }
                  }

 

For matList.add(mu);

It's adding all the materials to the matList regardless which jbbfc2__Workorder__r.Id it belongs too..How can i fix this? Right now i'm just adding all the records in the matList

 

Hello,

 

 

How can I rewrite the following so I don't run the soql in the for loop, however,

each Workorder has it's own material list of items.

 

		           	
                for(jbbfc2__Workorder__c wo : workorderList){  
		         materialUList = [select jbbfc2__Workorder__c, Name
                                from jbbfc2__MaterialU__c 
                                where jbbfc2__Workorder__r.jbbfc2__Status__c ='Closed' AND jbbfc2__Workorder__c =:wo.id];
 	             
                  InvoiceObj invObjItem = new InvoiceObj(wo, wrMap, materialUList);
                  this.invObjList.add(invObjItem);
                 }

 

Hello Community

 

If I write an Apex Scheduler to create a bunch of records at X day at Y Time.

 

When these records are created. Who would be the ownership of the Records? ie. Created By and Modified would be..?? 

(If I did not set these fields)

 

Would it be the person who sets the Scheduled Job?

 

Thank you,

davidjbb

Hello Community,

 

From my system.debug I got the following: 

2012-08-17 17:16:00

I am trying to do a SOQL on DateTime i.e

 where (jbbfc2__Start_Date__c >= :getFromDate() and jbbfc2__finished_date__c <= :getToDate())

 

However, my SOQL isn't taking into consideration of the dates and I believe it's the dateTime from getFromDate() and getToDate()

 

                //Get From Date

                public datetime getFromDate(){                  

                        System.debug('FROM DATE'+ controllerObject.Start_Date__c);

                        return this.fromDate = controllerObject.Start_Date__c;

                        

                }

 

How do I convert the DateTime to the following, so the query will work?

 

  • YYYY-MM-DDThh:mm:ss+hh:mm
  • YYYY-MM-DDThh:mm:ss-hh:mm
  • YYYY-MM-DDThh:mm:ssZ

Hello,

 

Is there a way to create a javascript-custom button/link to popup a window of Custom VisualForce Pages that a user can select one and redirect them to that page?

 

Thank you

davidjbb

Hello,

 

I need help with the following setScale, not sure why it's not working. I need to be able to set certain number fields with trailing 0. In this case I need a trailing 4 decimal places even if it's 0

 

quantity__c is Number(18, 0) (I had it set to 14,4..nothing changed)

 

m.quantity__c = (m.quantity__c).setScale(4);

 

The value would appear as ie. 10.0

 

If m.quantity__c was a string field I believe the setScale(4) works but i dont want to create unnecessary fields..

Hello,

 

The example provided by Salesforce:

 

<!-- Page: --> 
    

<apex:page controller="repeatCon" id="thePage">

    <apex:repeat value="{!strings}" var="string" id="theRepeat">

        <apex:outputText value="{!string}" id="theValue"/><br/>

    </apex:repeat>

</apex:page>

			

/*** Controller: ***/ 
    

public class repeatCon {



    public String[] getStrings() {

        return new String[]{'ONE','TWO','THREE'};

    }

}

 Displays 

 

<span id="thePage:theRepeat:0:theValue">ONE</span><br/>

<span id="thePage:theRepeat:1:theValue">TWO</span><br/>

<span id="thePage:theRepeat:2:theValue">THREE</span><br/>

 

How can I code it in a way it'll show the following:


ONE

TWO

THREE

 

Instead of

 

<span id="thePage:theRepeat:0:theValue">ONE</span><br/>

 

I plan on doing an export on the VF page using contentType and will display the following

 

<salorder>
"sForce",,,"The Landmark @ One Market",,"San Francisco","CA","94087","US"
"1","00004757" ,"7-9-2012","7-9-2012","0.00","0.00" 
"","1.0000","0.0000","0.00" Fieldworker Rate
</salorder>

 

I should be able to display the following above in the same format, spacing etc. The above would be considered one record so there will be multiple <salorder> </salorder> based off my data construction.

Hello,

 

I've recently installed our app into the client's production environment. We first had the app in their sandbox environment for testing before installing into production, however, when I went to uninstall the beta package due to an update on our app i got the following error:

 

This extension depends on the package you are trying to uninstall. [Name]

 

Do we need to refresh the sandbox because we have already installed the package on production?

 

If so, can I uninstall it on the sandbox and install a brand new one?

 

Thanks!

        
        <apex:selectList value="{!company}"  size="1" >
            <apex:selectOptions value="{!items}"/> 
       </apex:selectList>  

 

Is there a way to merge the rerender + action from the command button into the Select List. Currently, the Button refreshes the service Calendar based on the selected option, but I want it refreshed based on whatever was selected on the picklist instead of using the button

 

the companyView method has the getItems method from the selected options.

      

      <apex:commandButton rerender="serviceCalendarPanel"action="{!companyView}"value="Refresh Calendar"status="loadingStatus"/>

 

       

Hello Community. 

 

I have the following List.

 

List<jbbfc2__Fieldworker_Name__c> team = new List <jbbfc2__Fieldworker_Name__c>([Select Team__c From jbbfc2__Fieldworker_Name__c]);
 

 

 I can't do Select Distinct for SOQL, so how can I remove all the duplicate Team__c. I need the values to be inserted into a List collection.

 

I'm not that great in coding, so go easy on me :)

 

Thank you,

Davidjbb

Hello Community,

 

I want to retrieve the records of the custom/standard object of the current user. 

 

In addition, what if for example I want to grab the records of the current user and their profiled organization. I.E Bob's profile has set Organization to "Rakio". I want to grab records that belong to Bob who is the current user logged in, and "Rakio"

 

Thank you,
David 

Hi Community,

I need the startDate and finishDate to loop for each "ClosedWorkorders" in the VF page, not sure what to do. Please note I need the format of the VF page the way it is. I am planning to download the VF page as it is.

 

I could've done {!wo.jbbfc2__Start_Date__c} but its in date time format, either way.. I'm going to need a solution for looping startDate and finishDate for other similar code in the future

 

At the moment it's only picking up the date of one ClosedWorkorders

 

VF Page

<apex:repeat value="{!ClosedWorkorders}" var="wo" id="foreachworkorder" >

{!startSales}
{!wo.jbbfc2__Account__r.Name},,,{!wo.jbbfc2__Account__r.ShippingStreet},,{!wo.jbbfc2__Account__r.ShippingCity},{!wo.jbbfc2__Account__r.ShippingState},{!wo.jbbfc2__Account__r.ShippingPostalCode},{!wo.jbbfc2__Account__r.ShippingCountry}
{NUMBEROFDETAILLINES},{!wo.Name},{!startDate},{!finishDate},{!totalAmount},{!freightAmount}
{!endSales}
{!blank}
<apex:variable var="count" value="{!1}"/>
</apex:repeat>

 Apex Class:

//Get Closed Work Orders between From and To Date
		public void setClosedWorkorders(){

		this.ClosedWorkorders = [Select Name, CreatedDate, jbbfc2__Start_date__c, jbbfc2__Finished_Date__c,
			jbbfc2__Account__r.Name, jbbfc2__Account__r.Id,  jbbfc2__Account__r.ShippingCity, 
        	jbbfc2__Account__r.ShippingStreet, jbbfc2__Account__r.ShippingState, jbbfc2__Account__r.ShippingPostalCode, 
      		 jbbfc2__Account__r.ShippingCountry
			from jbbfc2__workorder__c 
			where jbbfc2__Start_Date__c > :getFromDate()  and jbbfc2__finished_date__c < :getToDate() and jbbfc2__status__c ='Closed'];
		
		}



//Set the Start Date for each Work Order
		public void setStartDate(){
		for(jbbfc2__Workorder__c wo: getClosedWorkorders()){
		this.startDate= string.valueof((wo.jbbfc2__Start_Date__c).date());	//TODO change to month date year format
		}	
		}
		//Get the Start Date for each Work Order
		public string getStartDate(){
		return this.startDate;
		}
		
		public void setFinishDate(){
		for(jbbfc2__Workorder__c wo: getClosedWorkorders()){
		this.finishDate = string.valueof((wo.jbbfc2__Finished_Date__c).date());	//TODO change to month date year format
		}
		}
		
		public string getFinishDate(){
		return this.finishDate;
		}

 

Hi Community,

I need the startDate and finishDate to loop for each "ClosedWorkorders" in the VF page, not sure what to do. Please note I need the format of the VF page the way it is. I am planning to download the VF page as it is.

 

I could've done {!wo.jbbfc2__Start_Date__c} but its in date time format, either way.. I'm going to need a solution for looping startDate and finishDate for other similar code in the future

 

At the moment it's only picking up the date of one ClosedWorkorders

 

VF Page

<apex:repeat value="{!ClosedWorkorders}" var="wo" id="foreachworkorder" >

{!startSales}
{!wo.jbbfc2__Account__r.Name},,,{!wo.jbbfc2__Account__r.ShippingStreet},,{!wo.jbbfc2__Account__r.ShippingCity},{!wo.jbbfc2__Account__r.ShippingState},{!wo.jbbfc2__Account__r.ShippingPostalCode},{!wo.jbbfc2__Account__r.ShippingCountry}
{NUMBEROFDETAILLINES},{!wo.Name},{!startDate},{!finishDate},{!totalAmount},{!freightAmount}
{!endSales}
{!blank}
<apex:variable var="count" value="{!1}"/>
</apex:repeat>

 Apex Class:

//Get Closed Work Orders between From and To Date
		public void setClosedWorkorders(){

		this.ClosedWorkorders = [Select Name, CreatedDate, jbbfc2__Start_date__c, jbbfc2__Finished_Date__c,
			jbbfc2__Account__r.Name, jbbfc2__Account__r.Id,  jbbfc2__Account__r.ShippingCity, 
        	jbbfc2__Account__r.ShippingStreet, jbbfc2__Account__r.ShippingState, jbbfc2__Account__r.ShippingPostalCode, 
      		 jbbfc2__Account__r.ShippingCountry
			from jbbfc2__workorder__c 
			where jbbfc2__Start_Date__c > :getFromDate()  and jbbfc2__finished_date__c < :getToDate() and jbbfc2__status__c ='Closed'];
		
		}



//Set the Start Date for each Work Order
		public void setStartDate(){
		for(jbbfc2__Workorder__c wo: getClosedWorkorders()){
		this.startDate= string.valueof((wo.jbbfc2__Start_Date__c).date());	//TODO change to month date year format
		}	
		}
		//Get the Start Date for each Work Order
		public string getStartDate(){
		return this.startDate;
		}
		
		public void setFinishDate(){
		for(jbbfc2__Workorder__c wo: getClosedWorkorders()){
		this.finishDate = string.valueof((wo.jbbfc2__Finished_Date__c).date());	//TODO change to month date year format
		}
		}
		
		public string getFinishDate(){
		return this.finishDate;
		}

 

Hi Community,

 

I'm looking to get a Apex Input Field on a VF page called, ex Page1

<apex:inputFieldid="fromDate"value="{!Workorder__c.Start_Date__c}"required="true"/>


and use it for whatever I want in an Apex Class then output that Input field on Page 2

 

I'm not sure how to setup the Apex Class to grab the Input Field from Page one, manipulate the Input Field in the Apex Class, and then Display it on Page 2

 

 

 

Hi Guys,

 

I need help writing a test method without using "delete,insert, or update" in the test method. 

 

The trigger activates another trigger that does a web call out so I want to make sure it doesn't

 

trigger AccToFieldworkerBD on Account (before delete) {

set<String> setAccUser = new set <String> ();

for (Account a :trigger.old){ 
if (a.teamlead__c==true)  { 
setAccUSER.add(a.username__c); 
}
}
list <jbbfc2__Fieldworker_name__c> toDel = new list <jbbfc2__Fieldworker_name__c> ([select jbbfc2__username__c from jbbfc2__Fieldworker_name__c where jbbfc2__username__c in :setAccUser]);

if (toDel.isEmpty() == false){
delete toDel;   
}
}

 

Hi Guys,

 

I need help with the following. I have another trigger that's not listed below, which im writing a test method for. How do I send invokeGAE in the test method as false so it does not trigger the web service call out.

*note the code below are in a separate package, so in the test method how do I reference the invokeGAE

 

 

public with sharing class FieldworkerTriggerConstant {

public static boolean invokeGAE = true;

}

 

//Does a web service call out

trigger FieldworkerGAE on Fieldworker_Name__c (after insert, after update, after delete)

{

if(FieldworkerTriggerConstant.invokeGAE==true)

{

}

}


Hello,

 

Is there a way to create records of a object based on a certain time ? For example, if it's 12am the Work Order object will create X number(X number depends) of Work Orders based on the time? Any tips or feedback on how to get this going would be most appreciated.

 

Cheers,

Davidjbb

Hello.

 

I need help removing all the picklist values from the following. I'm not sure how to do that. I want to be able to clear the selected picklist value then add a new one

 

 

jbbfc2__FieldworkersId__c = picklist field

mapWO = is a map



mapWO.get(v.id).jbbfc2__FieldworkersId__c = (remove all the values or unselect the value currently selected)

 

//add new value

mapWO.get(v.id).jbbfc2__FieldworkersId__c = v.Team_LeaderFWD__c;

Hello,

 

What's a good way to write test cases for fields that you've created within a class.

 

i've created alot of fields that are used on a VF page..I've already used all the methods within the Test case, but Salesforce shows a red line on the bolded.

 

My test method is also used within the same class.

 

so..

public with sharing class UMaterialController 

{

private string test;

test = 'asdf';

etc..etc..

 

public string getTest()
{
return test;
}

 

 

static testMethod void UMaterialControllerTest(){

 

}

}

 

 

Hello,

 

I have the following trigger to update the Visit object based off of the Workorder object. There is a Visit lookup on the Workorder object. Thus, ..the code checks if the Id from Visit and Workorder matches - the trigger will update. 

 

However, the trigger doesn't seem to fire. 

 

The changes on the Salesforce side is sent from a mobile that updates a field in the Workorder object. This has been tested. The field gets updated. (Date/time) I'm not sure what i'm doing wrong or why the trigger isn't being fired. 

 

trigger WorkorderToVisit on jbbfc2__Workorder__c (before update, before insert) {
set <Id> setWoId = new set <Id> ();
for(jbbfc2__Workorder__c wo: trigger.new){
setWoId.add(wo.Visit__c);
}
map <Id, Visit__c> mapVisit = new map <Id, Visit__c> ();
for(Visit__c v : [Select Id from Visit__c where Id in :setWoId]){
mapVisit.put(v.id, v);
}

list <Visit__c> UpdVisit = new list <Visit__c> ();
for(jbbfc2__Workorder__c wo: trigger.new){
if(mapVisit.ContainsKey(wo.Visit__c) == true){// if WO Id is true then update the visit object

mapVisit.get(wo.Visit__c).Customer_Notes__c = 'trigger works';
mapVisit.get(wo.Visit__c).Field_Notes__c = 'trigger works'; 
}
else{
mapVisit.get(wo.Visit__c).Customer_Notes__c = 'trigger works';
mapVisit.get(wo.Visit__c).Field_Notes__c = 'trigger works'; 
}
}
if(UpdVisit.isEmpty()==false){
update UpdVisit;
}
}

 

                  for(jbbfc2__MaterialU__c mu :[select jbbfc2__Workorder__c,jbbfc2__Workorder__r.Id, Name,
                  	jbbfc2__Material__r.jbbfc2__ProductCode__c,jbbfc2__Material__r.jbbfc2__UnitPrice__c,jbbfc2__quantity__c
                  	from jbbfc2__MaterialU__c where jbbfc2__Workorder__r.jbbfc2__Status__c ='Closed'])
                  {
              		  
              		  System.debug('Workorder Id' + mu.jbbfc2__Workorder__r.Id);
              		  System.debug('Material' + mu.Name);
              		  
              		  matList.add(mu);
              		  if(muMap.get(mu.jbbfc2__Workorder__r.Id)==null){	
              		  	
                      	muMap.put(mu.jbbfc2__Workorder__r.Id, matList);
              		  }
                  }

 

For matList.add(mu);

It's adding all the materials to the matList regardless which jbbfc2__Workorder__r.Id it belongs too..How can i fix this? Right now i'm just adding all the records in the matList

 

Hello,

 

 

How can I rewrite the following so I don't run the soql in the for loop, however,

each Workorder has it's own material list of items.

 

		           	
                for(jbbfc2__Workorder__c wo : workorderList){  
		         materialUList = [select jbbfc2__Workorder__c, Name
                                from jbbfc2__MaterialU__c 
                                where jbbfc2__Workorder__r.jbbfc2__Status__c ='Closed' AND jbbfc2__Workorder__c =:wo.id];
 	             
                  InvoiceObj invObjItem = new InvoiceObj(wo, wrMap, materialUList);
                  this.invObjList.add(invObjItem);
                 }

 

Hello Community,

 

From my system.debug I got the following: 

2012-08-17 17:16:00

I am trying to do a SOQL on DateTime i.e

 where (jbbfc2__Start_Date__c >= :getFromDate() and jbbfc2__finished_date__c <= :getToDate())

 

However, my SOQL isn't taking into consideration of the dates and I believe it's the dateTime from getFromDate() and getToDate()

 

                //Get From Date

                public datetime getFromDate(){                  

                        System.debug('FROM DATE'+ controllerObject.Start_Date__c);

                        return this.fromDate = controllerObject.Start_Date__c;

                        

                }

 

How do I convert the DateTime to the following, so the query will work?

 

  • YYYY-MM-DDThh:mm:ss+hh:mm
  • YYYY-MM-DDThh:mm:ss-hh:mm
  • YYYY-MM-DDThh:mm:ssZ

Hello,

 

I need help with the following setScale, not sure why it's not working. I need to be able to set certain number fields with trailing 0. In this case I need a trailing 4 decimal places even if it's 0

 

quantity__c is Number(18, 0) (I had it set to 14,4..nothing changed)

 

m.quantity__c = (m.quantity__c).setScale(4);

 

The value would appear as ie. 10.0

 

If m.quantity__c was a string field I believe the setScale(4) works but i dont want to create unnecessary fields..

Hello,

 

The example provided by Salesforce:

 

<!-- Page: --> 
    

<apex:page controller="repeatCon" id="thePage">

    <apex:repeat value="{!strings}" var="string" id="theRepeat">

        <apex:outputText value="{!string}" id="theValue"/><br/>

    </apex:repeat>

</apex:page>

			

/*** Controller: ***/ 
    

public class repeatCon {



    public String[] getStrings() {

        return new String[]{'ONE','TWO','THREE'};

    }

}

 Displays 

 

<span id="thePage:theRepeat:0:theValue">ONE</span><br/>

<span id="thePage:theRepeat:1:theValue">TWO</span><br/>

<span id="thePage:theRepeat:2:theValue">THREE</span><br/>

 

How can I code it in a way it'll show the following:


ONE

TWO

THREE

 

Instead of

 

<span id="thePage:theRepeat:0:theValue">ONE</span><br/>

 

I plan on doing an export on the VF page using contentType and will display the following

 

<salorder>
"sForce",,,"The Landmark @ One Market",,"San Francisco","CA","94087","US"
"1","00004757" ,"7-9-2012","7-9-2012","0.00","0.00" 
"","1.0000","0.0000","0.00" Fieldworker Rate
</salorder>

 

I should be able to display the following above in the same format, spacing etc. The above would be considered one record so there will be multiple <salorder> </salorder> based off my data construction.

Hello,

 

I've recently installed our app into the client's production environment. We first had the app in their sandbox environment for testing before installing into production, however, when I went to uninstall the beta package due to an update on our app i got the following error:

 

This extension depends on the package you are trying to uninstall. [Name]

 

Do we need to refresh the sandbox because we have already installed the package on production?

 

If so, can I uninstall it on the sandbox and install a brand new one?

 

Thanks!

        
        <apex:selectList value="{!company}"  size="1" >
            <apex:selectOptions value="{!items}"/> 
       </apex:selectList>  

 

Is there a way to merge the rerender + action from the command button into the Select List. Currently, the Button refreshes the service Calendar based on the selected option, but I want it refreshed based on whatever was selected on the picklist instead of using the button

 

the companyView method has the getItems method from the selected options.

      

      <apex:commandButton rerender="serviceCalendarPanel"action="{!companyView}"value="Refresh Calendar"status="loadingStatus"/>

 

       

Hello Community. 

 

I have the following List.

 

List<jbbfc2__Fieldworker_Name__c> team = new List <jbbfc2__Fieldworker_Name__c>([Select Team__c From jbbfc2__Fieldworker_Name__c]);
 

 

 I can't do Select Distinct for SOQL, so how can I remove all the duplicate Team__c. I need the values to be inserted into a List collection.

 

I'm not that great in coding, so go easy on me :)

 

Thank you,

Davidjbb

Hi Community,

 

I'm looking to get a Apex Input Field on a VF page called, ex Page1

<apex:inputFieldid="fromDate"value="{!Workorder__c.Start_Date__c}"required="true"/>


and use it for whatever I want in an Apex Class then output that Input field on Page 2

 

I'm not sure how to setup the Apex Class to grab the Input Field from Page one, manipulate the Input Field in the Apex Class, and then Display it on Page 2

 

 

 

Hi Guys,

 

I need help writing a test method without using "delete,insert, or update" in the test method. 

 

The trigger activates another trigger that does a web call out so I want to make sure it doesn't

 

trigger AccToFieldworkerBD on Account (before delete) {

set<String> setAccUser = new set <String> ();

for (Account a :trigger.old){ 
if (a.teamlead__c==true)  { 
setAccUSER.add(a.username__c); 
}
}
list <jbbfc2__Fieldworker_name__c> toDel = new list <jbbfc2__Fieldworker_name__c> ([select jbbfc2__username__c from jbbfc2__Fieldworker_name__c where jbbfc2__username__c in :setAccUser]);

if (toDel.isEmpty() == false){
delete toDel;   
}
}

 

Hello.

 

I need help removing all the picklist values from the following. I'm not sure how to do that. I want to be able to clear the selected picklist value then add a new one

 

 

jbbfc2__FieldworkersId__c = picklist field

mapWO = is a map



mapWO.get(v.id).jbbfc2__FieldworkersId__c = (remove all the values or unselect the value currently selected)

 

//add new value

mapWO.get(v.id).jbbfc2__FieldworkersId__c = v.Team_LeaderFWD__c;

Hello,

 

What's a good way to write test cases for fields that you've created within a class.

 

i've created alot of fields that are used on a VF page..I've already used all the methods within the Test case, but Salesforce shows a red line on the bolded.

 

My test method is also used within the same class.

 

so..

public with sharing class UMaterialController 

{

private string test;

test = 'asdf';

etc..etc..

 

public string getTest()
{
return test;
}

 

 

static testMethod void UMaterialControllerTest(){

 

}

}

 

 

Hello,

 

I have a trigger that creates a new record in another object.

 

The Name field is an autonumber with a display format of R-{0000}

 

This needs to display into another field of the other object. However, when that record is created the field is generated with the autonumber but not the display format of R-{0000}.


Any ideas on how I can still show the display format?


Cheers

Davidjbb