• jd123
  • SMARTIE
  • 567 Points
  • Member since 2012

  • Chatter
    Feed
  • 22
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 55
    Questions
  • 226
    Replies

We have our quote numbers set up as custom auto generated numbers, so that it shows the year, month and then the sequence number. Q- {YYYY}{MM}{000}. How can we make it reset to zero when the month changes? We the quote numbers are getting far too long.

 

What we need is for the following or trailing three numbers to be dependent on the month, so when it changes the following 3 digits reset. Is there a formula or rule we can make so that our numbers don't get too long?

Hi ,

 

My requirement is if the size of list is 0 then display error instead of the error message "List Has No rows.." i want to display use friendly error..Can anyone guide me?

 

List<Account> accs=[select id, Name from Account ]

if(accs.size()==0)

{

  "display error";

}

 

I am getting below error:

"System.LimitException: Too many SOQL queries: 101"

 

How can I optimize my code to avoid this exception?

Please, help me.

trigger My_AddCommissions_US  on Account (after insert,after update) {

    List<Commission__c> insertCommission=new List<Commission__c>();
    List<Commission__c> updateCommission=new List<Commission__c>();
    set<ID> setupdate=new Set<ID>();
    map<Id,ID> accownermap=new map<id,id>();
    List<Commission__c> lstcom=new List<Commission__c>();
    set<Id> Ownerset=new Set<Id>();   
    ID role;
    map<Id,User> usermap=new Map<Id,User>([select id ,Userroleid,ProfileId from user where IsActive=true]);        
    //Start
   
    //End
    Userrole adminrole1=[select id from Userrole where Name='System Administrator'];
    //system.debug('OOOO'+adminrole1.id);
    Userrole chinarole=[select id from Userrole where Name='China Users'];
    Userrole ITDEVrole=[select id from Userrole where Name='IT DEV'];
    Userrole ProMktgadmin=[select id from Userrole where Name='Pro Mktg Administrator'];
    Userrole ProMktguser=[select id from Userrole where Name='Pro Marketing User'];
    Userrole ProSalesSVP=[select id from Userrole where Name='Pro Sales SVP'];
    Userrole RPSM=[select id from Userrole where Name='RPSM'];
    Userrole MyProRep=[select id from Userrole where Name='My Pro Rep'];

    if(trigger.IsInsert){
        for(Account acc:trigger.new){
            role=usermap.get(acc.OwnerId).Userroleid;
            if(role!=RPSM.id && role!=MyProRep.id && role!=adminrole1.id && role!=chinarole.id && role!=ITDEVrole.id && role!=ProMktgadmin.id && role!=ProMktguser.id && role!=null){
                Commission__c com=new Commission__c();
                com.Account__c=acc.id;               
                com.Sales_Team_Member__c=acc.OwnerId;               
                com.Percent_of_Sale__c=100;
                insertCommission.add(com);
            }
        }
        insert insertCommission;
    }
    if(Trigger.Isupdate){
        for(Account acc:trigger.new){
            if(trigger.newmap.get(acc.id).Ownerid!=trigger.oldmap.get(acc.id).Ownerid){
                setupdate.add(acc.id);
                role=usermap.get(acc.OwnerId).Userroleid;
                if(role!=RPSM.id && role!=MyProRep.id && role!=adminrole1.id && role!=chinarole.id && role!=ITDEVrole.id && role!=ProMktgadmin.id && role!=ProMktguser.id && role!=null){
                    accownermap.put(acc.id,acc.OwnerId);
                    Ownerset.add(trigger.oldmap.get(acc.id).Ownerid);
                }
            }
        }
        lstcom=[select  id,Sales_Team_Member__c,Account__c from Commission__c where Account__c in :setupdate and Sales_Team_Member__c=:Ownerset];          
          
        for(Commission__c c:lstcom){
            c.Sales_Team_Member__c=accownermap.get(c.Account__c);          
            updateCommission.add(c);          
        }
        try{
            update  updateCommission;
        }
        catch(Exception e){
            system.debug('Update failed'+e.getmessage());
        }
    }
}

 

Hi all,

      I have this account search page  given below:

<apex:form >
    <apex:pageBlock mode="edit" id="block">

      <apex:pageBlockButtons location="both">
     
      </apex:pageBlockButtons>
      <apex:pageMessages />

      <apex:pageBlockSection >
        <apex:pageBlockSectionItem >
          <apex:outputLabel for="searchText">Account Name</apex:outputLabel>
          <apex:panelGroup >
          <apex:inputText id="searchText" value="{!searchText}"/>
          <apex:commandButton value="Search" action="{!search}" rerender="block" status="status"/>
          </apex:panelGroup>
        </apex:pageBlockSectionItem>
      </apex:pageBlockSection><br/>

      <apex:actionStatus id="status" startText="Searching... please wait..."/>
      <apex:pageBlockSection title="Search Results" id="resultsBlock"  columns="1">
        <apex:pageBlockTable value="{!searchResults}" var="item" rendered="{!NOT(ISNULL(searchResults))}" width="100%" columns="3">
         <apex:column headerValue="Select" width="10%">

           <apex:commandButton value="Select"  action="{!Redir}">
                 <apex:param name="msg" value="{!item.id}" assignTo="{!itemId}"/>
           </apex:commandButton>

          </apex:column>
          <apex:column value="{!item.Name}" headerValue="Account Name" width="45%"/>
          <apex:column value="{!item.Control_Number__c}" headerValue="Account Control Number" width="45%"/>
        </apex:pageBlockTable>
      </apex:pageBlockSection>
    </apex:pageBlock>
  
  </apex:form>

 On click of select button I want Account Id of selected accoutn to be passed into URL of another page:

 Here is the cntroller:

 

 

public with sharing class ItemEditController {

    public ItemEditController(ApexPages.StandardController controller) {

    }

  
  private ApexPages.StandardController controller {get; set;}
  public List<Account> searchResults {get;set;}
  public string searchText {get;set;}
  public string itemID {get;set;}
  
 
  // standard controller - Display all records present in the system
    public ItemEditController() 
  { 
    String soql= 'select name, Control_Number__c from Account order by name';
    Database.query(soql);
  }
 
  // fired when the search button is clicked
  public PageReference search() {
    String qry = 'select id, name,Control_Number__c from Account ' +
      'where name LIKE \'%'+searchText+'%\' order by name';
    searchResults = Database.query(qry);
    return null;
  }
  
  // fired for redirection to proposal page when select button is clicked
  public PageReference Redir(){

       PageReference pageRef = new PageReference(Page.Proposal_Edit.getURL() );
        //pageRef.getParameters().put('msg',itemID);
        pageRef.setRedirect(false);
        return pageRef;
    }
 
     public PageReference Redir1()
     {
         return null;
     }
 
}

 

I am unable to pass the value in destination URL .please help !!!!!!

 

 

1) what is the diff between standard obeject and user object?

2) who can use importwizard ?

3) what is field level security ?

4) diff between formula field and rollup summary field ?

5) what is related list section and button section ?

 

Hi all, 

 

I have a date field which is a date formula field based on a date/time field. This works correctly, but I would like to add a bit of extra functionality. My company has an SLA that anything after 5pm should be treated as being recieved the next day. Therefore I would like the date formula field to work as below:

 

If the date/time is 17/09/2012 12:56 the formula field will display 17/09/12.

If the date/time is 17/09/2012 17:30 the formula field will display 18/09/12.

 

Any ideas/help/solutions would be greatly appreciated especially as it is my first post!

 

Thanks

 

Matt

 

 code for deletion of all the records of an object at time

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

Error is in expression '{!save}' in component <apex:page> in page accountinsert...........
 
 
 
 
Please help , i have facing this problem in insert a fileds into an object
  • September 17, 2012
  • Like
  • 0

Hi,

 

Interview question: Can we write SOQL query in validation rule? Can anybody answer it for me?

Hi,

I Have created a custom object and inserted data into it. I have written a VisualForce Page and an Apex Controller to search the data. I could see the count in logs, but the data is not displaying on the VF Page. Below is my Code

 

VisualForce Page

 

<apex:page controller="ItemController">
<style>
.activeTab {background-color: #236FBD; color:white;
background-image:none}
.inactiveTab { background-color: lightgrey; color:black;
background-image:none}
</style>
<apex:tabPanel title="Panel1" inactiveTabClass="inactiveTab" switchType="client" selectedTab="addItem" activeTabClass="activeTab">
<apex:tab label="Add Items" name="Master1" id="addItem">
<apex:outputText >You Can add/Remove Items Details Here</apex:outputText>
<apex:form >
<!-- <apex:commandButton value="Add Item" reRender="details"/>-->

<apex:pageBlock title="details">
<apex:pageBlockSection title="ADD ITEMS">
<p> Item Name:<apex:inputText value="{!Name}"/></p>
<p> Item Desc:<apex:inputTextarea value="{!Name}" rows="3"/></p>
<p> Item Price:<apex:inputText value="{!Name}"/></p>
<p> Added By:<apex:inputText value="{!Name}"/></p>
<p> Added On:<apex:inputText value="{!Name}"/></p>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:tab>
<apex:tab label="Search Items" id="Master2">
<APEX:OUTputLabel >You Can Search For Items Here</APEX:OUTputLabel>
<apex:form >
<apex:outputLabel >Enter Item:</apex:outputLabel>
<apex:inputText id="searchText" value="{!searchText}"/>
<apex:commandButton value="Search" action="{!searchItem}" rerender="Results" status="status">
</apex:commandButton>

<apex:pageBlock >
<apex:actionStatus id="status" startText="requesting..."/>
<apex:pageBlockSection title="Results" id="results" columns="1">
<apex:pageBlockTable value="{!itemDetails}" var="items" rendered="{!NOT(ISNULL(itemDetails))}">
<apex:column value="{!items.Price__c}" headerValue="Price"/>

</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>

 

</apex:form>


</apex:tab>
<apex:tab label="View Sales" id="viewSales">
<apex:outputText >You can view the Sales Report Here</apex:outputText>
</apex:tab>
<apex:tab label="Buy Items" id="butItems">
<apex:outputText >You Can Buy Items here</apex:outputText>
</apex:tab>
</apex:tabPanel>
<apex:toolbar >
</apex:toolbar>

</apex:page>

 

Apex Controller

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

public class ItemController {
public String results { get; set; }
public List<ShopItem__c> itemDetails {get;set;}

public PageReference searchItem() {

String qry = 'select Price__c from ShopItem__c where ItemName__c =:searchText order By Price__c';
system.debug('Query:'+qry);
itemDetails = Database.query(qry);
// itemDetails = (List<ShopItem__c>)[select ItemName__c from ShopItem__c];
system.Debug('itemDetailssize***:'+itemDetails.size());
return null;
}


public String searchText { get; set; }

public String Name { get; set; }

public String ShopItem { get; set; }


public PageReference saveItem() {

return null;
}

}

 

Kindly Please help

 

Regards

Venkat

I'm trying to get into making some customizations with VF for the first time, so I may be missing something right off the bat. 

 

What I'm trying to do is replace the existing quote pdf that is generated. Specifically what I need to change is the order of how the items appear on the quote line items related list of the template. I knew going in that because the template is a pdf and not a regular page layout, I would need to completely override the functionality and start from scratch. After doing a little research on this, I think the best way to do it is a custom button to direct to a visualforce page that renders as a pdf, which was a pretty cool thing I just learned that you can do with vf pages. From there it would be rebuilding the structure of the page from the ground up, which shouldn't be a problem and I think, using a custom controller to set the order of the related list.

 

So, I got in a dev org to start some really early playing around with this before starting to work on it in a sandbox. The first thing  I tried was rendering as a pdf which worked great, but then I tried displaying the relatedlist and that's where I ran into problems. 

 

This is the markup I was using to test and the error is 'QuoteLineItem' is not a valid child relationship name for entity Quote 

 

<apex:page standardController="Quote">
<apex:detail relatedList="true" subject="{!Quote.Id}" title="test">
<apex:relatedList list="QuoteLineItem" rendered="true"/>
</apex:detail>
</apex:page>

 

So, I couldn't find anywhere that said I couldn't use QuoteLineItems as a vf related list, but nowhere that said I could either. So I guess I have two questions, the first being obviously, can I reference the QuoteLineItem child relationship in Quote controller VF page, and if so, what am I doing wrong. 

 

The second, since I gave in and posted on here after hours of research, is whether or not I am going about this the right way. Is there an easier way to override the quote pdf with an end goal of reordering that related list?

 

Any help, tips, links to some good resources would be much appreciated. 

 

--KC

Hey guys - I am having an issue and I just cannot figure it out. My trigger is made to create a new case and set certain fields of the new Case object. I am able to set all these fields, except for one, the Account field.

 

The Account field is a lookup field and for some reason, I am unable to set it. I have provided my code below. Any help would be greatly appreciated. 

 

 

trigger ProgDetailTriggerCase on BLND_DFDT_Project__c (after insert) {

    AssignmentRule aRule = new AssignmentRule();
    aRule = [SELECT id FROM AssignmentRule WHERE SobjectType = 'Case' AND Active = true limit 1];
    
    Database.DMLOptions dmlOpts = new Database.DMLOptions();
    dmlOpts.assignmentRuleHeader.assignmentRuleId = aRule.id;
    
    Id rtID = [select Id, name from RecordType where name = 'Implementation' and SObjectType = 'Case' limit 1].Id;
    
    Set<Id> accId = new Set<Id>();
    
    for (BLND_DFDT_Project__c pdt : Trigger.new){
            accId.add(pdt.BLND_Account_Link__c);
    }

    Map<Id, Account> accMaps = new Map<Id, Account>([SELECT Id, parentid FROM Account WHERE Id IN :accID]);
    
    for (BLND_DFDT_Project__c pdt : Trigger.new){
        Case newpdCase = new Case(
            Account = accMaps.get(pdt.BLND_Account_Link__c).parentid,
            Subject = 'New Program Detail Created',
            Priority = 'Medium',
            Status = 'New',
            Reason = 'Implementation',
            Description = 'Testing the trigger',
            RecordTypeId = rtID,
            Program_Detail__c = pdt.Id,
            Opportunity__c = pdt.BLND_Opportunity_Link__c
            ); 
            
            newpdCase.setOptions(dmlOpts);
            insert newpdcase;
            
            system.debug(newpdCase.Account);
    }
}

 

String a = 'Java';
String b = new String(a);
String c = 'Java';
System.Debug('***'+a);
System.Debug('***'+b);

Is it possible to create like this in apex,? In java it is possible.

Hi all,

 

Can anyone help me in solving the below scenario.

 

I have written an onclick javascript and called a method and passed one arguement into it.now i want to write a test method for the class which is declared as webservice.

 

/////JAVASCRIPT CODE////////

{!REQUIRESCRIPT("/soap/ajax/10.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/10.0/apex.js")}

var myvar = sforce.apex.execute("Insert_SSO_TimeManagement","insertSSO_TimeManagement",{oppID:"{!Opportunity.Name}"});

 

/////APEX CLASS/////

WebService static String insertSSO_TimeManagement(String oppID){

--

}

 

Please help me in writting the test method for the above class.

Hi folks,

 

I wrote the following trigger to disallow users to delete Notes of any kind:

 

trigger CannotDeleteNotes on Note (before delete) {
    List<Note> atts = Trigger.old;
    for(Note a:atts) {
    a.addError('In the interest of audit history, the deleting of notes has been disabled.'); 
    }
}

 

 

And the following class to test the trigger:

 

@IsTest
private class Note_Trigger_Test{
    static testMethod void testDelete(){
           Note nots= new Note(Title='Test note');
           Test.startTest();
           Database.DeleteResult result = Database.delete (nots, false);
           Test.stopTest();
           
           System.assert(!result.isSuccess());
           }

}

 

 

But received the following error upon running the test:

 

System.ListException: Missing id at index 0  Class.Note_Trigger_Test.testDelete: line 6, column 1

 

And cannot for the life of me figure out why. The Trigger and the testMethod are both ridiculously simple, but no joy. Am I missing something fundamental?

 

Annoyingly, the Trigger works fine, but I can't deploy it without the code coverage...

 

Thanks for any help you can give,

Lee

 

Hi,

 

My requirment is to store only the Created Date in a separate field in Lead Object. Currently there is a field Created By in the Lead Object which contains Name and Date. Is there any simple method to store only the created date value in a separate field?

 

Thanks

Hari G S

  • September 10, 2012
  • Like
  • 0

Hi Everyone,

 

This very simple VF page is not executing the getSiteEqp method when rendering the pageBlockTable.  I have verified that the SiteEqp list is properly loaded with 70 elements in the controller extension constructor, but it doesn't matter.  The system.debug statement is the first statement in the getSiteEqp method, but it is not logged in the execution log, so I think the getSiteEqp method is not even being executed.  Can anyone tell me why?  Here's the VF code:

 

<!-- Copyright Ebara International Corporation 2012 -->
<!-- Written by Darryl Singh -->
<apex:page standardController="Case" extensions="Assign_Case_Equip" >
<apex:form >
<apex:pageBlock id="SCE">
<h1 style="font-size:30px"><center>Assign Case Equipment</center></h1><br/>
<center>
<apex:commandButton value="Assign Selected" action="{!AssignSelected}" />
<apex:commandButton value="Assign All" action="{!AssignAll}" />
<apex:commandButton value="Cancel" action="{!Cancel}" />
</center>
<apex:pageMessages />
<apex:pageBlockTable value="{!SiteEqp}" var="SE" id="SEqp" columns="5" width="100%" >
<apex:column headerValue="Sel" style="width:98%" >
<apex:inputField value="{!SE.Selected__c}" style="width:98%" />
</apex:column>
<apex:column headerValue="Serial#" >
<apex:outputText value="{!SE.Name}" style="width:98%" />
</apex:column>
<apex:column headerValue="Model Number" >
<apex:outputText value="{!SE.Model_Number__c}" style="width:98%" />
</apex:column>
<apex:column headerValue="Position Number" >
<apex:outputText value="{!SE.Position_Number__c}" style="width:98%" />
</apex:column>
<apex:column headerValue="Part Number" >
<apex:outputText value="{!SE.Part_Number__c}" style="width:98%" />
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

 

and the controller extension . . .

 

// Copyright Ebara International Corporation 2012
// Written by Darryl Singh
public with sharing class Assign_Case_Equip {

// Class field definitions:
public list<Case_Equipment__c> deleteCE {get; set;}
public list<Case_Equipment__c> insertCE {get; set;}
public list<Site_Equipment__c> SiteEqp {get; set;}
public map<Id, Case_Equipment__c> CaseEquipMap {get; set;}
public final Case c;

public Assign_Case_Equip(ApexPages.StandardController stdController) {
this.c = (Case)stdController.getRecord();
list<Site_Equipment__c> SiteEqp = new List<Site_Equipment__c>();
map<Id, Case_Equipment__c> CaseEquipMap = new map<Id, Case_Equipment__c>();
for (Site_Equipment__c SE : [ select Id, Selected__c, Name, Model_Number__c, Position_Number__c, Part_Number__c
from Site_Equipment__c a where Site__c in (select Site_Number__c from Case where Id = :c.Id)
order by Name ]) SiteEqp.add(SE);
for (Case_Equipment__c CE : [ select Id, Site_Equipment__r.Id from Case_Equipment__c a where Case__c = :c.ID ]) {
CaseEquipMap.put(ce.Site_Equipment__r.Id, ce);
}
}

public list<Site_Equipment__c> getSiteEqp() {
system.debug('SiteEqp Size = ' + string.ValueOf(SiteEqp.Size()));
for(Integer x = 0; x < SiteEqp.size(); x++) {
Case_Equipment__c ce = CaseEquipMap.get(SiteEqp[x].Id);
if(ce == null) SiteEqp[x].Selected__c = False; else SiteEqp[x].Selected__c = True;
}
return SiteEqp;
}

public pageReference assignSelected() {
list<Case_Equipment__c> deleteCE = new list<Case_Equipment__c>();
list<Case_Equipment__c> insertCE = new list<Case_Equipment__c>();
for(Integer x = 0; x < SiteEqp.size(); x++) {
Case_Equipment__c ce = CaseEquipMap.get(SiteEqp[x].Id);
if(ce == null & SiteEqp[x].Selected__c == True) {
insertCE.add(new Case_Equipment__c(Site_Equipment__c = SiteEqp[x].Id, Case__c = c.Id));
}
if(ce <> null & SiteEqp[x].Selected__c == False) deleteCE.add(ce);
}
if(deleteCE.size() > 0) database.delete(deleteCE,false);
if(insertCE.size() > 0) database.insert(insertCE,false);
PageReference casePage = new ApexPages.StandardController(c).view();
return casePage;
}

public pageReference assignAll() {
list<Case_Equipment__c> deleteCE = new list<Case_Equipment__c>();
list<Case_Equipment__c> insertCE = new list<Case_Equipment__c>();
for(Integer x = 0; x < SiteEqp.size(); x++) {
Case_Equipment__c ce = CaseEquipMap.get(SiteEqp[x].Id);
if(ce == null) {
insertCE.add(new Case_Equipment__c(Site_Equipment__c = SiteEqp[x].Id, Case__c = c.Id));
}
}
if(insertCE.size() > 0) database.insert(insertCE,false);
PageReference casePage = new ApexPages.StandardController(c).view();
return casePage;
}

public pageReference Cancel() {
PageReference casePage = new ApexPages.StandardController(c).view();
return casePage;
}
}

Am having trouble getting coverage for the following webservice class - would like assistance

have some experience getting coverage on simpler classes and on triggers but am not finding coverage responding the same way to this webservcie.

thanks for any help!

 

Global class PersonCoverage {
    
    Webservice static String addCoveragePerson(Coverage_Person__c[] coverageList){
        
        List <Contact> contacts = new List<Contact>();
        List<Account> accounts = new List<Account>();
         List<User> users = new List<User>();
        List<Coverage_Person__c> coverages = new List<Coverage_Person__c>();
        String status = '';
        String message = '';
        List<Coverage_Person__c> missingCoverage = new List<Coverage_Person__c>();
        
        for(Coverage_Person__c coveragePerson:coverageList){
            
            Savepoint sv = Database.setSavepoint();
                
            accounts = [SELECT A.ID,A.NAME FROM Account A WHERE A.AIMS_CLIENT_ID__c = :coveragePerson.aims_client_id__c limit 1 ];
            contacts = [SELECT c.EMP_ID__c,c.Name FROM Contact c where c.EMP_ID__c = :coveragePerson.emp_id__c limit 1];
            users = [SELECT c.EMP_ID__c,c.Name FROM User c where c.EMP_ID__c = :coveragePerson.emp_id__c and IsActive=true limit 1];
            coverages = [SELECT C.ID,C.NAME FROM Coverage_Person__c C WHERE C.aims_coverage_id__c = :coveragePerson.aims_coverage_id__c and c.emp_id__c = :coveragePerson.emp_id__c limit 1 ];
        
            if(accounts.size() == 0 ){
            	 if(message == '')
            	 	message = 'No Inst for Account addPersonCoverage';
            	 message += coveragePerson;
            	 missingCoverage.add(coveragePerson);
            	 status = 'Error';
                //Notifier.DoNotification(' No Inst for Account addPersonCoverage::'+coveragePerson.aims_client_id__c,coveragePerson);
                //return 'ERROR: Missing client: '+aimsClientId ;
                continue;
            }
            
            if(contacts.size() == 0){
            	if(message == '')
            	 	message = 'No Contact for Account addPersonCoverage';
                message += coveragePerson;
                missingCoverage.add(coveragePerson);
                //return 'ERROR: Missing client: '+aimsClientId ;
                continue;
            }
            
            //if the coverage exists, then delete it first
            if(coverages.size() != 0){
            	Coverage_Person__c deleteCoveragePerson = coverages[0];
                try{
                    Database.delete(deleteCoveragePerson);    
                }catch(DmlException e){
                    Database.rollback(sv);
                    Notifier.DoNotification('PersonCoverage.deleteCoveragePerson: ERROR on deleteCoveragePerson: '+e.getDmlMessage(0), deleteCoveragePerson);
                } 
            }
            
            Account acct = accounts.get(0);
            Contact contact = contacts.get(0);
            if(users.size()!=0){
            	User user = users.get(0);
            	coveragePerson.User__c = user.Id;
            }
            
            coveragePerson.Account__c= acct.Id;
            coveragePerson.Contact__c = contact.Id;  
            coveragePerson.name = contact.name;
            try{
                Database.insert(coveragePerson);    
            }catch(DmlException e){  
                Database.rollback(sv);
                Notifier.DoNotification('PersonCoverage.addCoveragePerson: ERROR on Inserting Of Coverage: '+e.getDmlMessage(0), coveragePerson);
            }
            
             
        }
        
        if(status == 'Error'){
        	Notifier.DoCoverageNotification(' Missing data on addCoveragePerson:::',missingCoverage);
        }
        
        return message; 
    }
    
     Webservice static String deleteCoveragePerson(Coverage_Person__c[] coverageList){
     	
     	String message = '';
     	String status = '';
     	List<Coverage_Person__c> missingCoverages = new List<Coverage_Person__c>();
         
        List<Coverage_Person__c> coverages = new List<Coverage_Person__c>();
        
        for(Coverage_Person__c coveragePerson:coverageList){
            
            Savepoint sv = Database.setSavepoint();
                
            coverages = [SELECT C.ID,C.NAME FROM Coverage_Person__c C WHERE C.aims_coverage_id__c = :coveragePerson.aims_coverage_id__c limit 1 ];
        
            if(coverages.size() == 0 ){
            	status = 'Error';
            	if(message == '')
            		message = 'No Coverage for deleteCoveragePerson';
            	message += coveragePerson; 
            	missingCoverages.add(coveragePerson);
                //Notifier.DoNotification(' No Coverage for deleteCoveragePerson::'+coveragePerson.aims_coverage_id__c,coveragePerson);
                //return 'ERROR: Missing client: '+aimsClientId ;
            }else{  
                Coverage_Person__c deleteCoveragePerson = coverages[0];
                try{
                    Database.delete(deleteCoveragePerson);    
                }catch(DmlException e){
                    Database.rollback(sv);
                    Notifier.DoNotification('PersonCoverage.deleteCoveragePerson: ERROR on Deleting Of Coverage: '+e.getDmlMessage(0), deleteCoveragePerson);
                }   
            }
               
        }
        
        if(status == 'Error'){
       		 Notifier.DoCoverageNotification(' No Coverage for deleteCoveragePerson::',missingCoverages);
        }
        
        return message; 
    }
    
}

 

 

Just as start, this gets 15%

 

@isTest(SeeAllData=true)
public with sharing class PersonCoverageTest2 {
    static testMethod void sampleMethodTest() {
        
        
        List <Contact> contacts = new List<Contact>();
        String status = '';   
      	List<Global_Coverage__c> existingCoverageList = new List<Global_Coverage__c>();
      	List<User> users = new List<User>();
        Account target = new Account (name='target', Aims_client_id__c ='99999');
        insert target;
        
        Contact coveringuy = new Contact (lastname='bob', accountid=target.id , EMP_ID__c = 4683);
      	
      	List<Coverage_Person__c> coverages = new List<Coverage_Person__c>();
      	
        Coverage_Person__c coveragePerson = new Coverage_Person__c(emp_id__c = 4683, aims_client_id__c = '99999', aims_coverage_id__c=1,shortname__c = 'FIDEL', account__c=target.id  );
        
        List<Account> accounts = [SELECT Id FROM Account A where a.AIMS_CLIENT_ID__c = :coveragePerson.aims_client_id__c limit 1 ];
        
        List <Coverage_Person__c> coverageList = new List <Coverage_Person__c>();
        
	PersonCoverage.addCoveragePerson(coverageList);
        
        
        insert coveringuy;
        insert coverageperson;
        
        contacts = [SELECT c.EMP_ID__c,c.Name FROM Contact c where c.EMP_ID__c = :coveragePerson.emp_id__c limit 1 ];   
        
        System.assertNotEquals(accounts.size(),0);
        System.assertNotEquals(contacts.size(),0);
        
        Savepoint sv = Database.setSavepoint();
 	  
 	   accounts = [SELECT A.ID,A.NAME FROM Account A WHERE A.AIMS_CLIENT_ID__c = :coveragePerson.aims_client_id__c limit 1 ];
 	   contacts = [SELECT c.EMP_ID__c,c.Name FROM Contact c where c.EMP_ID__c = :coveragePerson.emp_id__c limit 1];
 	   users = [SELECT c.EMP_ID__c,c.Name FROM User c where c.EMP_ID__c = :coveragePerson.emp_id__c and IsActive=true limit 1];
 	   coverages = [SELECT C.ID,C.NAME FROM Coverage_Person__c C WHERE C.aims_coverage_id__c = :coveragePerson.aims_coverage_id__c and c.emp_id__c = :coveragePerson.emp_id__c limit 1 ];
        
        integer acctsize = accounts.size();
      	integer ctctssize = contacts.size();
        integer coveragesSz = coverages.size();
        
        
        system.assertNotequals(coveragesSz,0);
        system.assertNotequals(acctsize,0);
        system.assertNotequals(ctctssize,0);
        
       
    }
}

 

 

  • September 05, 2012
  • Like
  • 0

1.Create quote button from opportunity page (detail page) is giving the below error when clicked.
  This custom button is calling URL /apex/ManageQuote/ apex code but its giving error

Error
--System.NullPointerException: Attempt to dereference a null object line 31 column 1 which is under public PageReference createQuote() of ManageQuoteController code.

 

can let us know what is the issue?Thanks in advance for help

 

 


Code snippet:
---ManageQuoteController code
:
public with sharing class ManageQuoteController {
    //Opportunity Reference
    public Opportunity opportunityRef {get; set;}
    //Quote Creation Error
    public Boolean quoteCreationError {get; set;}
    //Quote created indicator
    public Boolean quoteCreated {get; set;}
    //Error Message
    public String errorMessage {get; set;}
    //Quote URL
    public String quoteUrl {get; set;}
    //Default Controller
    public ManageQuoteController() {
        quoteCreated = false;
        quoteCreationError = false;
        Id opptyId = ApexPages.currentPage().getParameters().get('opportunity.id');
        try{
        opportunityRef = [select Id, Name from Opportunity where Id = :opptyId];
        }
        catch (System.QueryException e) {
          System.debug('caught ya!');
        }
    }
   
    public PageReference goback() {
        return new Apexpages.Standardcontroller(opportunityRef).view();
    }
   
    public PageReference createQuote() {
        Opportunity oppty = [select Id, Name, StageName, CloseDate, Owner.Name, AccountId, Account.Name,
            Account.Sic, Account.Industry, Account.BillingStreet, Account.BillingCity, Account.BillingState,
            Account.BillingPostalCode, Account.BillingCountry from Opportunity where Id = :opportunityRef.Id];
        OpportunityContactRole ocr = [select Contact.FirstName, Contact.LastName, Contact.EMail, Contact.Phone, Contact.Fax
            from OpportunityContactRole where opportunityId = :opportunityRef.Id and IsPrimary = true];
        QuoteResponse response = QuoteServiceDelegate.createQuote(oppty, ocr.Contact);
        if (response.stausCode != 200) {
            quoteCreationError = true;
            errorMessage = response.message;
        } else {
            quoteCreated = true;
            quoteUrl = response.quoteUrl;
        }
        return null;
    }
}



---Manage Quote code

<apex:page name="ManageQuote" controller="ManageQuoteController" id="thisPage" tabStyle="Opportunity">
        <script type="text/javascript">
                function init() {
                        if ('{!quoteCreationError}' == 'false' && '{!quoteCreated}' == 'false')
                                createQuote();
                }
                window.onload = init;
    </script>
        <apex:form >
                <apex:actionFunction name="createQuote" action="{!createQuote}"  rerender="outputBlock, quoteBlock" status="createStatus" />
                <apex:sectionHeader title="Manage Quote" subtitle="{!opportunityRef.Name}"/>
                <apex:outputPanel id="outputBlock">
                        <apex:actionStatus id="createStatus">
                                <apex:facet name="start">
                                        <apex:pageBlock >
                                                <apex:outputText >Creating quote. Please wait...</apex:outputText>
                                        </apex:pageBlock>
                                </apex:facet>
                        </apex:actionStatus>
                </apex:outputPanel>
                <apex:outputPanel id="quoteBlock">
                        <apex:pageBlock id="errorBlock" title="Error" rendered="{!quoteCreationError}">
                                <apex:pageBlockButtons location="bottom">
                                        <apex:commandButton value="Go Back" action="{!goback}" />
                                </apex:pageBlockButtons>
                                <apex:pageBlockSection columns="1">
                                        <apex:outputText value="{!errorMessage}"/>
                                </apex:pageBlockSection>
                        </apex:pageBlock>
                        <apex:iframe src="{!quoteUrl}" scrolling="true" id="quoteFrame" rendered="{!quoteCreated}"/>
                </apex:outputPanel>
        </apex:form>
</apex:page>

  • August 30, 2012
  • Like
  • 0

trigger myAccountTrigger on Account(before delete, before insert, before update,
after delete, after insert, after update) {
if (Trigger.isBefore) {
if (Trigger.isDelete) {

// In a before delete trigger, the trigger accesses the records that will be

// deleted with the Trigger.old list.

for (Account a : Trigger.old) {
if (a.name != 'okToDelete') {
a.addError('You can\'t delete this record!');
}
}
} else {

// In before insert or before update triggers, the trigger accesses the new records

// with the Trigger.new list.

for (Account a : Trigger.new) {
if (a.name == 'bad') {
a.name.addError('Bad name');
}
}
if (Trigger.isInsert) {
for (Account a : Trigger.new) {
System.assertEquals('xxx', a.accountNumber);
System.assertEquals('Banking', a.industry);
System.assertEquals(100, a.numberofemployees);
System.assertEquals(100.0, a.annualrevenue);
a.accountNumber = 'yyy';
}

// If the trigger is not a before trigger, it must be an after trigger.

} else {
if (Trigger.isInsert) {
List<Contact> contacts = new Contact[0];
for (Account a : Trigger.new) {
if(a.Name == 'makeContact') {
contacts.add(new Contact (LastName = a.Name,
AccountId = a.Id));
}
}
insert contacts;
}
}
}}}

 

TEST CLASS

@istest
private class myAccountTrigger
{
static testmethod void test()
{
account a=new account(name='makeContact',accountnumber='xxx',industry='banking',numberofemployees=100,annualrevenue=100);
insert a;

system.assertequals(a.accountNumber,'xxx');

account k=new account(name='bad');
try{
insert k;
System.assert(false);
}
catch (Exception e)
{

}

system.assertnotequals('okToDelete',a.name);
delete a ;                // AND HERE IT IS GIVING ERROR 

 

ERROR IS System.DmlException: Delete failed. First exception on row 0 with id 0019000000E4eDUAAZ; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, You can't delete this record!: []
STACK TRACE:Class.myAccountTrigger.test: line 22, column 1


}
}

 

 

GETTING 71 % TEST COVERAGE.. ANY HELP WILL BE APPRECIATED

Hi 

 

   I would like to give dynamic ids based on the no of result which I get.

 

Like 

 

newTextBoxDiv.after().html('<table><tr><td><input type="text" name="textbox' + counter +
'" id="textbox' + counter + '" value="" style="padding:5px 0px 0px 0px;" ></td><td style="display: block;"><img src="r-arrow.png" alt="" onClick="functionCall(this.id)" id="textBox2RightArrowImage1' + counter + '"></td>'+
'<td style="display: none;"><img src="d-arrow.png" alt="" id="textBox2DownArrowImage1' + counter + '"></td></tr></table>');

 

it is working in html but not in apex.

 

 

Any help is appreciated.

  • February 26, 2013
  • Like
  • 0

Hi,

I am new to Customer Portal and I am using Customer Portal Manager Standard.

Two objects.

1.Installed Products

2.Service orders

 

If Customer is creating any service order so he is owner the record so he can able to see his records in the Customer Portal. If Suppose the customer is calling to Call Center Agent to create a Service Order then the Owner of the Service Order is Call Center Agent.

 

      Now, My questions is how can I show Service Orders based on Account and Contact lookup 

 

Let me explain some more.

In my Service Order Object I have to fields

1.Account

 2.Contact

 

   If customer is creating or Call Center Agent is creating Service Order both should access that records. How can I achieve this.

 

Please help me.  

------------
Mahi
  • February 20, 2013
  • Like
  • 0

Hi,

I am new to Customer Portal and I am using Customer Portal Manager Standard.

Two objects.

1.Installed Products

2.Service orders

 

If Customer is creating any service order so he is owner the record so he can able to see his records in the Customer Portal. If Suppose the customer is calling to Call Center Agent to create a Service Order then the Owner of the Service Order is Call Center Agent.

 

      Now, My questions is how can I show Service Orders based on Account and Contact lookup 

 

Let me explain some more.

In my Service Order Object I have to fields

1.Account

 2.Contact

 

   If customer is creating or Call Center Agent is creating Service Order both should access that records. How can I achieve this.

 

Please help me.  

  • February 19, 2013
  • Like
  • 0

Hi,

 

  I have

1.Service Order(parent)

2. Technician Assignment ( 1.lookup to Service Order 2.lookup to Contact(External Technician))

3.Time 

 

I have created one visualforce page with web tab here I am showing all the Service Orders which are assigned to Contact(External Technician).

When Contact(External Technician) is login into customer portal the default tab is My Assigned Service Orders. Here the Technician can open any service Order and he can enter time for that particular Service Order he can modify the Service Order Status 'Completed' or 'Cancelled' but the record is not editing giving this error

 

Insufficient Privileges

You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary. 

Click here to return to the previous page.

 

I know he is not the owner of this record and I didn't give any sharing rules. I am totally confusing how to give Assigned Service Orders permissions to external technician(Contact)

 

 I got an Idea Can we use High Volume Customer Portal license if clone this Profile I can give all Service Order permissions "View All" and "Modify All" think it will workout for my requirement but I would like to know

 

 1. Am I right or wrong. Is there any other limitations.

 2. How much cost for High Volume Customer Portal license.

 

Is there any other way to do in my  Customer Portal Manager Standard Profile. 

The technician is able to see all his Assigned Service Orders but he couldn't able to enter the Time and Modify the Service Order.

 

Any help is Appreciated.

 

 

  • February 19, 2013
  • Like
  • 0

Hi 

 

 I have 

 

1.Service Order (parent) is Assigning to multiple technicians (Contacts)

 

 When Technician is login into customer portal in one Visualforce pages I am showing all the Service Orders of that particular Contact(Technician).

 

 up to here it is working fine.

 

Here the Technician (Contact) Can enter Time, material, Expense ones he enter time if I am clicking save it is giving an error.

 

  I have given New,Edit,Delete  permissions my license is Customer Portal Manager Standard 

 

  Insert failed. First exception on row 0; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: []

Error is in expression '{!saveAndNew}' in component <apex:page> in page fconnect:technician_time_entry
Any help is Appreciated.
  • February 18, 2013
  • Like
  • 0

HI

 

 I have two custom objects

 

1. Activity(Parent)   2. material(child)

 

 Actvity view page is Visualforce page 

 

URl Is 

 

https://enterprise-drive-9784--fconnect.na9.visual.force.com/apex/ActivityViewPage?id=a00E0000006VEZH&sfdc.override=1

 

material relatedlist i have button "New Material" On Actvity Detail Page.

 

If i am clciking on "New materail" button the page navigating Material_New page (this one came from pacakage)

 

Url is https://enterprise-drive-9784--fconnect.na9.visual.force.com/apex/New_Material?CF00NE0000003kDiK=10&CF00NE0000003kDiK_lkid=a00E0000006VEZH&scontrolCaching=1&retURL=%2Fapex%2Ffconnect__ActivityViewPage%3Fid%3Da00E0000006VEZH%26sfdc.override%3D1&sfdc.override=1

 

here my client reqirement is changed so I would like to create a New Visualforce page in the Trial Org.So i create a new page Trial_New_Materail. I overrided with this new Visualforce page.when i am clcking on New material button on Actvity detail page 

 

I am getting below error messsage

 

URL No Longer Exists

You have attempted to reach a URL that no longer exists on salesforce.com. 

 

and my url is coming like this

(this page is comming from fconnect package)

https://enterprise-drive-9784--fconnect.na9.visual.force.com/apex/New_Materials?CF00NE0000003kDiK=10&CF00NE0000003kDiK_lkid=a00E0000006VEZH&scontrolCaching=1&retURL=%2Fapex%2Ffconnect__ActivityViewPage%3Fid%3Da00E0000006VEZH%26sfdc.override%3D1&sfdc.override=1

 

if i am opning my page 

like apex/Trial_New_Materail then it is working fine 

 

https://enterprise-drive-9784--c.na9.visual.force.com/apex/New_Materials?retURL=%2Fapex%2Ffconnect__ActivityViewPage%3Fid%3Da00E0000006VEZH%26sfdc.override%3D1&CF00NE0000003kDiK_lkid=a00E0000006VEZH&CF00NE0000003kDiK=10&sfdc.override=1&scontrolCaching=1

 

if i am replacing fconnect with c. it is working fine why my url is coming with fconnect eventhough i ovveride the Material New button with visualforce apge which has been developed in the trial org.

 

Please any one help me.

  • January 22, 2013
  • Like
  • 0

Hi 

 

I have one object Shedule have Monday_Start_Time and Monday_End_Time like up to Sunday_Start_Time and Sunday_End_Time so total 14 fields. I would like to display like this.

 

 

  Day                  Start Time                       Endtime

 

 Monday              6:00 AM                        6:00 PM                    Clear button

 Tu esday            ---                                  -----                            Clear button

 wenesday          -------                             -----                            ----------

  ------

  ----

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

Sunday                ---                                      --------                    Clear Button

 

  

Clear All  button:

 

 

when i am clicking Clear All button all fields should null. If i am clicking on particuler Clear button that row values(may Monday start time and End time) should null.

 

Any help is greatly Appricated.

 

 

  • December 17, 2012
  • Like
  • 0

Hi,

 

     I have Service Level  object and it has fields like

 

 1. Monday  Start time and

 2. Monday End time

 

   like Up to Sunday Start Time and sunday end Time.

 

 Here i need to enter the Start time and End time. I am thinking instead of taking pick list I would like to take as Time picker.

 

how can we do this Please any one help me. 

  • December 14, 2012
  • Like
  • 1

Hi

 

I have one object  Order 

fields Acccount (lookup) and contact (lookup)

when i am login as customer portal user  i can see one tab i.e Order

 

when i am creating new Order 

 

   account and Contact should populate but account and contact are not popuating.

from the contact only i have enabled customer portal so i have contact and account so based on login information account and Contact should popuate but i don't know why it is not popuating please any onle help me.

 

i think for this we need to write code some set up i messed please let me know 

 

  • December 06, 2012
  • Like
  • 0

Hi

 

I have one object  Order 

fields Acccount (lookup) and contact (lookup)

when i am login as customer portal user  i can see one tab i.e Order

 

when i am creating new Order 

 

   account and Contact should populate but account and contact are not popuating.

from the contact only i have enabled customer portal so i have contact and account so based on login information account and Contact should popuate but i don't know why it is not popuating please any onle help me.

 

i think for this we need to write code some set up i messed please let me know 

  • December 06, 2012
  • Like
  • 0

Hi,

 

 I have enabled two tabs(Object1, Object 2) into the customer portal.

These two objects have the lookup to Account and Contact. After creating Object1 record I can the account and contacts but the link is not coming. When I click on the link the page should navigate to Account or Contact page.

 

Any help is Appreciated.

  • December 06, 2012
  • Like
  • 0

Hi Everyone,

my requirement is i have two objects, 1.Stattfing_Plan (Parent)     2. Staffing_Resorces__c(Child)  

Staffing plan is estimation to complete the Project (project is have only one Staffing plan).Staffing plan have multiple Staffing resources (Employees).

 

if suppose in my parent object (Staffing_Plan__c) i have given Start_Date__c 11/26/2012 and  weeks is 5.

then for all recosures dynamically i should add 5 input text or fields dynamically for all child records fo Staffing_Pan__c  

like this

 

 Staffing_Pan__c

 

Start_date__c -----11/26/2012

weeks---------------3

 

child records  (page block table)

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

                               

Name            11/26/2012       12/04/2012       12/11/2012

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

mahender     inputtext              inputtext             inputtext 

surender        inputtext             inputtext             inputtext 

nareder            inputtext          inputtext            inputtext 

 

 

like it should create and when i am saving these values it should save in the database.

 

 

------------
Mahi
  • November 27, 2012
  • Like
  • 0

Hi,

 

    I have to objects

 

Parent__c and Child__c

I have fields in my parent Start_Date__c and No_Of_Fields__c

if I am giving as input  No_Of_Fields__c=3 in my parent object Parent__c  then in my child object 3 fields should create dynamically and it should show in pageblock table like

 

Name, Start_Date(if today) , today+7, today+14 and when I am clicking save it should save in my child object.

 

If I am giving 4 or 5 those many fields should create in my child object  and values should save.

 

Any help is Appreciated.

  • November 26, 2012
  • Like
  • 0

Hi

 

 I have two fields

     1. Start_Date__c

     2. End_Date__c

  

if I am giving date values like Start_Date__c=10/01/2012 and End_Date__c=3/31/2013

 

the next period should create based on  no of months difference between Start_Date__c and End_Date__c

 

first time is calculating right Start_Date__c=4/1/2013  and End_Date__c=9/30/2013

 

again it should calculate as same above. It should give result Start_Date__c=10/01/2012 and End_Date__c=3/31/2013

but it is giving Start_Date__c=10/01/2012 and End_Date__c=3/30/2013

 

I know it is giving wrong result when the month have 30 and 31

 

 

 

  • October 18, 2012
  • Like
  • 0

Hi 

 

      I have two fileds on Custom__c object

 

      1.TextArea1__c

      2.TextArea2__c

 

                     if i enter some text like 

 

                            1) Hi

                            2) How are you? 

 

 

               after inserting i am updating TextArea2__c. In the output i am getting like this 

                

                        1) Hi 2) How are you? but i want same as Fist field. I would like to display excatly same as first field format 

 

Any help is Appreciated.

 

            

  • October 18, 2012
  • Like
  • 0

Hi

 

  Any one please helm me out.

 

Any help is greatly Appreciated.

  • October 12, 2012
  • Like
  • 0

Hi 

 

   I am new to webservice, Any help is Greatly Appreciated.

  • October 11, 2012
  • Like
  • 0

Hi

 

  I ma new to integration any one please help me out how can I integrate ADP payroll System.

 

Any help is Greatly Appreciated.

 

 

  • October 09, 2012
  • Like
  • 0

 

first time it is working 

I have two object sales Order and Sales Order Item

in sales Order Item Sales Order field is should auto populate but it populating only one time second time onwards the parent sales Order Is not popuating   

public PageReference saveAndNew()
{
insert sa;
//Service__c s=[select id,Name from Service__c where id=:sa.Service__c];
//PageReference p=new PageReference('/apex/ServiceActivity_New?CF00NE000000223mT='+s.Name+'&CF00NE000000223mT_lkid='+sa.Service__c+'&scontrolCaching=1&retURL=%2F'+sa.Service__c+'&sfdc.override=1');
PageReference p= ApexPages.currentPage();
p.setRedirect(true);
return p;
}

 

only one time it is working ??

please help me 

  • August 28, 2012
  • Like
  • 0

Hi,

 

     I have Service Level  object and it has fields like

 

 1. Monday  Start time and

 2. Monday End time

 

   like Up to Sunday Start Time and sunday end Time.

 

 Here i need to enter the Start time and End time. I am thinking instead of taking pick list I would like to take as Time picker.

 

how can we do this Please any one help me. 

  • December 14, 2012
  • Like
  • 1

Hi 

 

   I would like to give dynamic ids based on the no of result which I get.

 

Like 

 

newTextBoxDiv.after().html('<table><tr><td><input type="text" name="textbox' + counter +
'" id="textbox' + counter + '" value="" style="padding:5px 0px 0px 0px;" ></td><td style="display: block;"><img src="r-arrow.png" alt="" onClick="functionCall(this.id)" id="textBox2RightArrowImage1' + counter + '"></td>'+
'<td style="display: none;"><img src="d-arrow.png" alt="" id="textBox2DownArrowImage1' + counter + '"></td></tr></table>');

 

it is working in html but not in apex.

 

 

Any help is appreciated.

  • February 26, 2013
  • Like
  • 0

Hi 

 

 I have 

 

1.Service Order (parent) is Assigning to multiple technicians (Contacts)

 

 When Technician is login into customer portal in one Visualforce pages I am showing all the Service Orders of that particular Contact(Technician).

 

 up to here it is working fine.

 

Here the Technician (Contact) Can enter Time, material, Expense ones he enter time if I am clicking save it is giving an error.

 

  I have given New,Edit,Delete  permissions my license is Customer Portal Manager Standard 

 

  Insert failed. First exception on row 0; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: []

Error is in expression '{!saveAndNew}' in component <apex:page> in page fconnect:technician_time_entry
Any help is Appreciated.
  • February 18, 2013
  • Like
  • 0

Hi,

 

  In my trial Org I have created a customer portal and I have done all the setup but tabs are not showing when I am login into customer portal.

 

   but previously I done customer portal in my packaged Org and when I am try login that customer portal the tabs are showing my question is Is I need to do any extra setup in my trial Org?

Hello,

 

I've searched far and wide and spent a good time thinking about the best way to solve the below problem, but I'm either not sure how to do them or which would be the best solution.

 

I have a couple of projects I'm working on that require an auto numbering of some sort, but not the auto-numbering field out of the box.  I need child records of a partent to be numbered 1 though n based onspecific critiera, a date field and 2 lookups (date__c, contact__c, fund__c) - if there are multiple records on the same day with the same contact/fund they should be the same number.  That being said, here are the solutions I've come to...

 

1)  Create a workflow that runs off of a count rollup, assigning the number +1 to the new child. 

Problem: not dynamic enough, not enough control on the groupings 

 

2) Use SQL to number the records, this would require a daily export/import to assign the numbers - while this wouldn't be a huge burden on our api I would prefer not to use this method

 

3) Some how do this in java - I don't know java

 

4) use a trigger - I could firgure this out, but I don't think it's the best way.

 

5) use batch apex - not sure how to do this

 

Any ideas?

Hi

 

based on my client requirement i should add two lines code to my managed pacakge trigger but it is not possible so my idea is i would like to a create a new Trigger in my trial Org and dectivate the existing trigger in my managed package.

 

so my object has two triggers is it will create any security issue.

 

plese help me any other best way to do this. 

Trigger updateamount on Fund_Transfer__c (before update) {
    Fund_Transfer__c[] transfer;
    Fund_Transfer__c fund = Trigger.new[0];
    transfer = [SELECT Amount__c,Account_No__c FROM Fund_Transfer__c WHERE Account_No__c =: fund.Account_No__c ];
    if(transfer.size()>0){
        transfer.Amount__c = transfer.Amount__c + fund.Amount__c;
        update transfer;
    }
    else{
        system.debug('sorry transaction stopped');
    }             
}

 

 

please help me to correct this error

Hi,

 

 I have enabled two tabs(Object1, Object 2) into the customer portal.

These two objects have the lookup to Account and Contact. After creating Object1 record I can the account and contacts but the link is not coming. When I click on the link the page should navigate to Account or Contact page.

 

Any help is Appreciated.

  • December 06, 2012
  • Like
  • 0

hi friends,

 

    my requirement is when you enter the zip code it automatically populates the details of city,state.

i creating a some data base of records.

and i worked on workflow for field update.

work flow rule criteria is: when ever record is created or edited.

in field update i am entering a formula like this

 

city__c +"," +state__c +"-"+Zip_code_Pin_code__c

 

there is no errors in the formula editor..but execution wil be to display what ever we have to enter the zip code value that will be disply to all remaining fields..

 

will you please suggest where is the mistike i have to done..

Hi Everyone,

my requirement is i have two objects, 1.Stattfing_Plan (Parent)     2. Staffing_Resorces__c(Child)  

Staffing plan is estimation to complete the Project (project is have only one Staffing plan).Staffing plan have multiple Staffing resources (Employees).

 

if suppose in my parent object (Staffing_Plan__c) i have given Start_Date__c 11/26/2012 and  weeks is 5.

then for all recosures dynamically i should add 5 input text or fields dynamically for all child records fo Staffing_Pan__c  

like this

 

 Staffing_Pan__c

 

Start_date__c -----11/26/2012

weeks---------------3

 

child records  (page block table)

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

                               

Name            11/26/2012       12/04/2012       12/11/2012

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

mahender     inputtext              inputtext             inputtext 

surender        inputtext             inputtext             inputtext 

nareder            inputtext          inputtext            inputtext 

 

 

like it should create and when i am saving these values it should save in the database.

 

 

------------
Mahi
  • November 27, 2012
  • Like
  • 0

Hi Everyone,

 

I want to insert a record in Case with fields Name, Email.

 

I'm confused how to write SOQL query for retrieving the account name (=case name) and Contact Email (=case email).

 

Please help me in writing a SOQL query for this.

 

 

  • November 26, 2012
  • Like
  • 0

Hi,

 

    I have to objects

 

Parent__c and Child__c

I have fields in my parent Start_Date__c and No_Of_Fields__c

if I am giving as input  No_Of_Fields__c=3 in my parent object Parent__c  then in my child object 3 fields should create dynamically and it should show in pageblock table like

 

Name, Start_Date(if today) , today+7, today+14 and when I am clicking save it should save in my child object.

 

If I am giving 4 or 5 those many fields should create in my child object  and values should save.

 

Any help is Appreciated.

  • November 26, 2012
  • Like
  • 0

i need a trigger for Zip code mapping.

 when u enter a zip code it automatically populates the related list of city state and counrty.

It will also work for the lead comes from Web also (Web to Lead).

Hi, I have an requirement to roll up opportunity amount to all contacts linked through contact roles for an opportunity. Do any one have solution for this.

Thanks,

Ramesh V