• jiah.choudhary
  • NEWBIE
  • 95 Points
  • Member since 2013

  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 42
    Replies

Hi

 

i have two objects  quote (parent ),purchase order(child)

 

am writing sub query but am getting error

 

please tell me can any where am missing

 

List<Quote__c> quotes = [Select id,Height__c,Width_Forula_C2__c,(select id,Height_Num__c,Quote__c,Product_Code__c,Width_Num__c from Purchase_Orders__r) From Quote__c where Id in: mapOrderIdAllsco.keyset()];

am getting this error

 





Didn't understand relationship 'Purchase_Orders__r' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names

 

 

regards

venkatesh

 

Hi,

I want to use images in place of default checkbox in salesforce. So that when the user clicks on the image its corresponding checkbox gets selected at the back end.Any idea how can I achieve that in visualforce??

 

Thanks in advance

 

Regards,

Aakash

  • November 27, 2013
  • Like
  • 0

I'm quite new to triggers and I can't seem to figure out what this error is refering to. 

 

Expression cannot be assigned at line -1 column -1

 

Here is my code:

 

trigger UpsertPBE on Product2 (after insert, after update) {

sObject s = [select ID from Pricebook2 where IsStandard = TRUE];
Set<ID> ids = Trigger.newMap.keySet();
list<PricebookEntry> entries=new list<PricebookEntry>();

if(trigger.isinsert){
for (Product2 p : Trigger.new) {
entries.add(
new PricebookEntry(
Pricebook2Id=s.ID,
Product2Id=p.ID,
UnitPrice=p.Item_Cost__c,
IsActive=p.IsActive,
UseStandardPrice=FALSE)
);
}
insert entries;
}

list<PricebookEntry> pbe = [SELECT Id, UnitPrice FROM PricebookEntry WHERE Product2ID in :ids];

if(trigger.isupdate){
for (Product2 p : Trigger.new) {
if (pbe != null) {
PricebookEntry.UnitPrice=p.Item_Cost__c; }
}
}
}

 

 

 

we have two fields in product object  Ampics_PL__c and Pieces_in_Pack__c where we need to fetch the value from Ampics='utilix ' picklist value and assaign to the Pieces_In  for eg  we have Cable/10002  this 10002 must be split and assaign to Pieces_in_Pack__c custom field

 

 

Error:Expression cannot be assigned at line -1 column -1

 

 

trigger UpdateProductField on Product2 (after insert, after update) {

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

for (Product2 Product : Trigger.new) {
    if(Product.Ampics_PL__c != null && Product.Ampics_PL__c.equals('Utilix')) {
        product2ID.add(Product.Id);
    }
}




List<Product2> UpdateProductField = new List<Product2>();

for(Product2 p:[Select Id, Ampics_PL__c,Pieces_in_Pack__c from product2 where Ampics_PL__c = 'Utilix'] )
 {
    Product2.Ampics_PL__c = Product2.Ampics_PL__c;        
     String str = 'Ampics_PL__c';
               String[] sstr = str.split('/');
               system.debug(sstr[0]);
               system.debug(sstr[1]);
}

          
     
update UpdateProductField;   
 
 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Hi

 

i have two objects  quote (parent ),purchase order(child)

 

am writing sub query but am getting error

 

please tell me can any where am missing

 

List<Quote__c> quotes = [Select id,Height__c,Width_Forula_C2__c,(select id,Height_Num__c,Quote__c,Product_Code__c,Width_Num__c from Purchase_Orders__r) From Quote__c where Id in: mapOrderIdAllsco.keyset()];

am getting this error

 





Didn't understand relationship 'Purchase_Orders__r' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names

 

 

regards

venkatesh

 

Hi There,

 

I am getting an error when trying to save an Inventory record. I have a trigger on the Inventory Object which is causing the error.

 

Been strruggling with the trigger for days but couldn't find a solution.

 

I'm posting the trigger here

 

Please help me.

 

Thanks and Kind Regards

 

Finney

 

trigger CreateBankingExsLease on pb__InventoryItem__c(before update){
  List<pb__InventoryItem__c> invs = new List<pb__InventoryItem__c>();
  List<ID> invIds = New List<ID>();

  for( pb__InventoryItem__c inv: Trigger.new){
  invs.add(inv);
  invIds.add(inv.Id);
  pb__InventoryItem__c beforeUpdate = System.Trigger.oldMap.get(inv.Id);
     
  if (beforeUpdate.Property_Managed__c != inv.Property_Managed__c){ 
    
      
    }
  }

  List <pb__Agreement__c> Ag = [ SELECT Id, pb__InventoryId__c, pb__AgreementType__c, Stage__c  from
pb__Agreement__c where pb__InventoryId__c = :invIds and pb__AgreementType__c = 'Lease' and Stage__c = 'Transaction Closed and Commission Received'LIMIT 5];
 for(pb__Agreement__c agg : Ag)
    {
        for(pb__InventoryItem__c i: invs) 
  if(i.Property_Managed__c == true)
  Agg.Banking_Lease__c =  'Yes';
 
  update Ag;   
  
  }

  
}
  • November 28, 2013
  • Like
  • 0

I have created one custom object and  i got this error 

System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Parent]: [Parent]

Error is in expression '{!UploadFile}' in component <apex:commandButton> in page vffileupload

 

 

Class.VFFileUpload.UploadFile: line 26, column 1

-------------------------------------------------------------------------------

 

public class VFFileUpload
{
public Id recId
{ get;set; }

public VFFileUpload(ApexPages.StandardController ctlr)
{
recId = ctlr.getRecord().Id;
}

public string fileName
{ get;set; }

public Blob fileBody
{ get;set; }

public PageReference UploadFile()
{
PageReference pr;
if(fileBody != null && fileName != null)
{
Attachment myAttachment = new Attachment();
myAttachment.Body = fileBody;
myAttachment.Name = fileName;
myAttachment.ParentId = recId;
insert myAttachment;
pr = new PageReference('/' + myAttachment.Id);
pr.setRedirect(true);
return pr;
}
return null;
}
}

 

 

-------------------

 

<apex:page standardController="MyCustomObject__c" extensions="VFFileUpload">
<apex:form>
<apex:pageBlock title="Upload Attachment">
<apex:inputFile style="width:100%" id="fileToUpload" value="{!fileBody}" filename="{!fileName}" />
<apex:commandButton value="Upload Attachment" action="{!UploadFile}"/>
</apex:pageBlock>
</apex:form>
</apex:page>

I've to write a trigger on "Line_Item__c" object and

field are: Name(Text), Unit Price(Currency), Unit Sold(number), Total Price(Formula:unit_price_c*Unit_sold__c),

 Invoice Statement(Master-Detail:Invoice_Statement__c)

 

Second Object is "Invoice_Statement__c"

and fields are: Name(AutoNumber), Invoice Value(Roll-up summary:Sum of Total_Price__c field of Line_Item__c),

Account__c(Look-up field: Account) 

 

Third Object is "Account"

and fields are: Name(Text), Account_Balance__c(Currency)

 

Now i have to write trigger on "Line_item__c" object to insert total price into Account_Balance__c field of Account.

Please help me if anyone know how to do this.

Hi,

 

I am not able to rerender my pageBlockButtons.Initially i will disable the button using apex variable on change of picklist in javascript iam calling action function and setting the value to false and rerenderin the pageblock button id.

 

It is not at all reflecting .I Apperciate your help.

 

below is my code

 

<apex:pageBlockButtons id="pageBlockButtons1" location="both" rendered="true">
<apex:actionRegion id="ButtonsRegion">
<apex:commandButton action="{!UpdatePriority}" disabled="{!submitflag}" id="SubmitButton" value="Update" rendered="true"/>
</apex:actionRegion>
</apex:pageBlockButtons>

 

<apex:pageBlockSection title="{!$Label.Update_Priority_Duedate}" id="EditPriorfieldsPB" collapsible="true" rendered="true">
<apex:repeat id="repeat1" value="{!$ObjectType.temp__c.FieldSets.EditPriority}" var="stdR0">
  <apex:inputfield id="userval" value="{!con[stdR0]}" required="{!OR(stdR0.required, stdR0.dbrequired)}" onChange="DateValidation(this.value,'{!stdR0.fieldPath}');" rendered="true"/>
  </apex:repeat>
</apex:pageBlockSection>

 

<apex:actionFunction name="jsDateValidation" action="{!actionFunDateValidations}" rerender="pageBlockButtons1" immediate="true">
 <apex:param assignTo="{!dateDetails}" value="" id="DateDetails" name="dateVal"/>
</apex:actionFunction>

 

 

 

     I am trying to display the record name (Inchead.name) in vfpage after click the save button(display in same page).. but "{!Inchead.id}" is working fine.. but  {!Inchead.name} is not displayed in vf page

 

public Incident__c getInchead() {
      
      if(Inchead == null) Inchead = new Incident__c();
      return Inchead;
   }

 

public void save(){

Insert Inchead;

}

 

 

Vf

 

<apex:outputText value="{!Inchead.name}"/>

  • November 27, 2013
  • Like
  • 0

Hi,

I want to use images in place of default checkbox in salesforce. So that when the user clicks on the image its corresponding checkbox gets selected at the back end.Any idea how can I achieve that in visualforce??

 

Thanks in advance

 

Regards,

Aakash

  • November 27, 2013
  • Like
  • 0

The requirement is to stop updating contact owner when the account owner is changed based on below 2 criterias

1.if the account_rating__c='High Rater'


  • November 21, 2013
  • Like
  • 0

Hi I am new to salesforce, so think this will be an elementary question.

 

The scenario is On Saving a VF form page a pop up has to populate having a value (which was entered in one of the field of VF form). Need help how to get this dynamic value in popup message?

Hi,

 

Probably missed something, but I HAVE looked. Just starting to scratch around at VF

 

We have a Custom Object. We have a button to clone a copy of a template in this Object, all good.

 

Want to add to the Clone VF page the ability to set a user (Project Officer)

 

Reading around, this code looks promising

 

<apex:inputField value="{!Milestone1_Project__c.Project_Officer__c}"
    required="true"/> 

 

it even works! Brings up a lookup and you can pick, in fact you can't press Save unless you do!

:)

 

Then when you save, it hasn't recorded what you picked :(

 

What have I missed?