• Pundareekam Kudikala
  • NEWBIE
  • 25 Points
  • Member since 2014

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 6
    Replies
Hi, 

I am writing a test class for this trigger.

Query in Trigger:
List<PermissionSetAssignment> list1= [select id from PermissionSetAssignment WHERE PermissionSetId IN(select id from permissionSet where label='A') AND AssigneeId=:Userinfo.getUserId()];

Now how to pass the user ID in session info to trigger so that this query returns the rows.

I am creating my test user who is assigned to permission set 'A' in my test class. I just need to pass this user id in session info so that when trigger executes and the list is not empty.


Can any one help me?

Regards,
raj
Here is my code below.
<apex:page sidebar="false" controller="SightingsValidatorController" tabStyle="Sightings_Validator__tab">
    
    <apex:sectionHeader title="{!TEXT($User.Validation_Specialization__c)}" subtitle="Sightings Validation"  />

    <apex:form >
       
        <apex:pageBlock title="Details for {!detailSighting.Species__r.Name} by {!detailSighting.CreatedBy.Name}" id="sightingDetails" rendered="{!detailsRenderFlag}" >
            
            <apex:pageBlockSection collapsible="false">
                <apex:panelGrid >
                    <apex:panelGrid columns="2">
                        Validation Status <apex:inputField value="{!detailSighting.Validation_Status__c}"/>
                    </apex:panelGrid>
                    <apex:panelGrid columns="1">
                        Comment:<apex:inputTextarea cols="47" rows="8"/> 
                    </apex:panelGrid>
                </apex:panelGrid> 
                <apex:map width="500px" height="200px" mapType="satellite" zoomLevel="3" id="themap">
                    <apex:mapMarker position="{!detailSighting.Location__Latitude__s},{!detailSighting.Location__Longitude__s}"/>
                </apex:map>
                
            </apex:pageBlockSection>    
        </apex:pageBlock>

        <apex:pageBlock title="Overview">
            <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" value="Save"/>
                <apex:commandButton action="{!reset}" value="Reset"/>
            </apex:pageBlockButtons>
            <apex:pageBlockSection collapsible="false" columns="1" >
                <apex:pageBlockTable value="{!Sightings}" var="a" id="sightings" rows="5">
                    <apex:column headerValue="Date" >
                        <apex:outputLink value="/{!a.Id}">
                            <apex:outputText value="{0,date,long}">
                                <apex:param value="{!a.Date__c}" /> 
                            </apex:outputText>                           
                        </apex:outputLink>
                    </apex:column> 
                    
                    <apex:column headerValue="Species Name">
                        <apex:outputText value="{!a.Species__r.Name}" style="{!if(a.Species__r.Rarity__c='Very Rare', 'color:red;font-weight:bold;', if(a.Species__r.Rarity__c='Rare','color:red;',''))}"></apex:outputText>
                    </apex:column>
                    
                    <apex:column headerValue="Seen By"  value="{!a.CreatedBy.Name}"/>
                    <apex:column headerValue="Show Details">
                        <apex:image value="{!$Resource.GoogleMapsIcon}" />
                        <apex:actionSupport event="onclick" action="{!ShowDetails}" reRender="sightingDetails">
                            <apex:param name="PARAM1" value="{!a.Id}" assignTo="{!selectedRowId}"/>
                        </apex:actionSupport>
                    </apex:column>
                    <apex:column value="{!a.Validation_Status__c}"/>
                </apex:pageBlockTable>
            </apex:pageBlockSection>
            <apex:pageBlockSection columns="3" >
                <apex:outputText ></apex:outputText>
                <apex:outputPanel >
                    <apex:commandButton value="First" action="{!setCon.first}" disabled="{!!setCon.hasPrevious}"> 
                    </apex:commandButton>
                    <apex:commandButton value="Previous" action="{!setCon.previous}" disabled="{!!setCon.hasPrevious}" title="Previous" />
                    <apex:outputText >Page {!setCon.pageNumber} of {!TotalPageNumbers} </apex:outputText>
                    <apex:commandButton value="Next" action="{!setCon.next}" disabled="{!!setCon.hasNext}" title="Next">
                    </apex:commandButton>
                    <apex:commandButton value="Last" action="{!setCon.last}" disabled="{!!setCon.hasNext}" title="Last" />

               </apex:outputPanel>
                <apex:outputText ></apex:outputText>
            </apex:pageBlockSection>           
        </apex:pageBlock>  

    </apex:form> 
    
</apex:page>

I want to rerender sightingDetails of pageblock. When i put reRender attribute in CommandButtons hilighted, my command buttons are not working. I am using standardset controller
Unable to pass values from VF to into controller extension. table.bid.Amount__c is not passing the entered values into Apex code. Pls suggest
code below:

VF Code

            <apex:pageBlockTable value="{!listScreenDataTable}" var="table" id="filteredItems" align="center" rows="5">
                
                <apex:column headerValue="Bid">
                    <apex:inputField value="{!table.bid.Amount__c}" required="true" id="inputAmount" />
                </apex:column>
                <apex:column headerValue="Item Name">
                    <apex:commandLink onclick="window.open('/{!table.item.Id}', '_blank'); return false;">{!table.item.Name}</apex:commandLink>
                </apex:column>
                <apex:column value="{!table.item.Minimum_Bid__c}"/>
                <apex:column value="{!table.item.Highest_Bid__c}"/>
                <apex:column value="{!table.item.Category__c}"/>
                <apex:column value="{!table.item.Closing_Date__c}"/> 
                
            </apex:pageBlockTable>


Apex Code:

 public List<ScreenDataTable> listScreenDataTable {get;set;}


 System.debug('Bid ID:'+ s.bid.Id + ' amount: ' + s.bid.Amount__c + 'item: ' + s.item.Id );

 //Wrapper Class for hold screen data Table
    public class ScreenDataTable {
        
        public Bid__c bid { get; set; }
        public Item__c item { get; set; }
        
        public ScreenDataTable(Bid__c bid, Item__c item) {
            this.bid = bid;
            this.item = item;
        }
    }
I have a list of sObjects and also know its field names. We need to retrieve these field values and build a custom object out of it. sObject.getSobject() returns an object and which needs to stored in various fields of the Custom Objects. The data types of fields in custom objects are LongTextArea, ID, Datetime. 

Any idea how to do this. 
Hi All,

I have a trigger on Lead
 which insert a record on a custom object (Lead looks up to custom object) which causes a trigger on custom object to fire to relate lead with the custom object. But surprisingly newly created lead does not come up on my soql query (every other matching record is available)? Is there any reason for that or Salesforce has a limitation doing so?

Any help will be appreciated? 
Hi, 

I am writing a test class for this trigger.

Query in Trigger:
List<PermissionSetAssignment> list1= [select id from PermissionSetAssignment WHERE PermissionSetId IN(select id from permissionSet where label='A') AND AssigneeId=:Userinfo.getUserId()];

Now how to pass the user ID in session info to trigger so that this query returns the rows.

I am creating my test user who is assigned to permission set 'A' in my test class. I just need to pass this user id in session info so that when trigger executes and the list is not empty.


Can any one help me?

Regards,
raj
I have an object that is filled from fields from another object. I created  a list of the same object type and I need to add the records to it. However it is giving me the Index out of bounds error when I add the record to the list. Here follows the code:

Line__c MELI                = new Line__c();                
List<Line__c> LMELI  = new List<Line__c>();

List<TX__c> Trx     = [SELECT  Id,  Amount__c
                                      FROM TX__c 

integer i = 0;

for (TX__c PMT : Trx) {
             
            MELI.MB__c             = Ref__c;                
            MELI.Tx__c                = PMT.Id;                                       
            MELI.Amount__c      = PMT.Amount__c;   
            LMELI.add(i++, MELI);                                               // The error is on this line                               
                          
    }  // for PMT ends here


I would greatly appreciate any help!

Thank you!
  • April 18, 2014
  • Like
  • 0