• Long Nguyen 19
  • NEWBIE
  • 50 Points
  • Member since 2015

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

I'm writing searching function in javascript which allows to search accounts and display them to VF page by using apex:pageBlockTable
I use sforce.connection to query data. I get a list of accounts but i dont know how to pass them to apex:pageBlockTable. Please suggest how to this.
My code is below:
if(search != null) {
                sforce.connection.sessionId = '{!$Api.Session_ID}';
                try{ 
                    var query = "find \{" + search + "\}" + " in all fields RETURNING Account (id, name, billingstreet, billingcity, billingpostalcode)"; 
                    var result = sforce.connection.search(query); 
                    if (result) {
                    	var records = result.getArray("searchRecords");   
                        for (var i=0; i<records.length; i++) {
                           var record = records[i].record;
                         //need to pass value to apex table here

                         }
                                              
                    }
                }  
                catch(e) { 
                    alert('An Error has Occured. Error:' +e); 
                }
            }
Code for displaying account information in VF page:
 
<apex:pageBlockSection columns="1" id="pbs">
                            <apex:pageBlockTable value="{!accounts}" var="account" id="pbt">
                                <apex:column headerValue="Name">
                                    <apex:outputLink value="#" onclick="fillIn('{!account.Name}', '{!account.id}');closeWindow();">{!account.Name}</apex:outputLink>
                                </apex:column>
                                
                                <apex:column headerValue="City" value="{!account.BillingCity}"/>
                                <apex:column headerValue="Street" value="{!account.BillingStreet}"/>
                                <apex:column headerValue="Postcode" value="{!account.BillingPostalCode}"/>
                            </apex:pageBlockTable>
                    	</apex:pageBlockSection>




 
I am writing a search popup that when click on the search icon , a popup dialog is opened. From there, i can search account with input text then pass value(account name, account id) back to the main window which is a textInputField
The problem is that, the textInputField in main window is not editable. Please suggest the way to fix. You can see the code below:
<apex:pageBlockSectionItem id="tpbsi">
                    <apex:outputLabel value="Account"/>
                    <apex:outputPanel id="oppnl">
                    	<apex:inputHidden value="{!accountId}" id="targetId"/>
                        <apex:inputText size="40" value="{!accountName}" id="targetName"
                                        onfocus="this.blur()" disabled="false" html-readonly="false"/>
                        <a href="#" onclick="openLookupPopup('{!$Component.targetName}', '{!$Component.targetId}')">
                            <apex:image id="search" url="/s.gif" styleClass="lookupIcon" onmouseover="this.className='lookupIconOn';" onmouseout="this.className='lookupIcon';" />
                        </a>
                    </apex:outputPanel>
</apex:pageBlockSectionItem>
User-added image
 
Hi Experts,

I am having one issue that still not find the way to fix. I have a table airport has 2 colums: airportcode(PK), airportname . Another table is flight which has 3 columns: flightcode(PK), origin, destination.
airport has one to many relationship with flight ---> 1-n . But flight table has origin and destination which are linked to airport.
So what kind of this relationship between flight and airport? can anyone advise me about this?
Hi experts,

I have written a schedule job which should run every 6 minutes/day. My question is how can i start this job, do we need to setup anything in Setup?
global class ScheduleAccountConvertion implements Schedulable{
    
    global void execute(SchedulableContext sc){
    
		AccountConvertion acc = new AccountConvertion();
        acc.accountConvertion();
        
        System.schedule('Scheduled Job 1', '0 0 * * * ?', new ScheduleAccountConvertion());
        System.schedule('Scheduled Job 2', '0 6 * * * ?', new ScheduleAccountConvertion());
        System.schedule('Scheduled Job 3', '0 12 * * * ?', new ScheduleAccountConvertion());
        System.schedule('Scheduled Job 4', '0 18 * * * ?', new ScheduleAccountConvertion());
        System.schedule('Scheduled Job 5', '0 24 * * * ?', new ScheduleAccountConvertion());
        System.schedule('Scheduled Job 6', '0 30 * * * ?', new ScheduleAccountConvertion());
        System.schedule('Scheduled Job 7', '0 36 * * * ?', new ScheduleAccountConvertion());
        System.schedule('Scheduled Job 8', '0 42 * * * ?', new ScheduleAccountConvertion());
        System.schedule('Scheduled Job 9', '0 48 * * * ?', new ScheduleAccountConvertion());
        System.schedule('Scheduled Job 10', '0 54 * * * ?', new ScheduleAccountConvertion());
        
    } 
}

 
Hi Experts,

I check the Community User profile and see that the create permission is disable for Account object.
So my question is that how community user can create account when they do registration?
Hi Expert,

In my trigger below, new Account is created when trigger happens on Appointment__c object:
if(Trigger.isInsert){
            for(Appointment__c newRec : Trigger.new) {
                    Account converted = new Account(
                    LastName =  UserInfo.getLastName(),
                    FirstName = UserInfo.getFirstName(),
                    ABN_ACN__c = newRec.ABN__c,
                    Entity_Name__c = newRec.Legal_Entity_Name__c,
                    Trading_Name__c = newRec.Business_Trading_Name__c,
                    Owners__c = newRec.Owner_s__c,
           
                    );
                System.debug('long converted.Name' + converted.Name);
                newRec.Legal_Entity_Name__c = converted.Name;
                lstAccounts.add(converted);
            }
            upsert lstAccounts;
    }
This problem is that converted.Name is Null. As i know, when First Name and Last name are populated for an Account then Account.Name should be populated also. Pls show me the way to fix this issue?

 
Hi Experts,

I want to test my controller which has below query:
List<AsyncApexJob> lstApexJob = [SELECT ApexClassId,status FROM AsyncApexJob where ApexClassId in:mapIDs.keySet()and (completedDate=yesterday or completedDate=today) ];
Because there's no Job which is completed on Yesterday or Today so the List is empty and my test coverage cannot reach target percent. So I tried to create a AsyncApexJob data for testing but system said that this object is not writeable:
AsyncApexJob aaj = new AsyncApexJob(completedDate=Date.today());
insert aaj;
Please show me the way to fix this issue.
 
Hi All,
I am trying to setup self registration for my communities, but still not working with this error: "Your request cannot be processed at this time. The site administrator has been alerted."
I already setup for these features:
- The community is already published.
- The Account Owner has a User Role assigned.
- The site guest user  has Create and Read permissions on the Account and Contact objects.
- Self-registration is enabled for the community
- Already entered the profile id and account id in CommunitiesSelfRegController class

Can anyone tell me what is the missing step here?
 
Hi Experts,

I enabled Chatter Answers in my Community and added Q&A tab to it. With Admistrator profile, i can post question and answer , but with other profile i am not able to do this. There's no button displayed like the snapshot below.  Anyone can tell me the  required permission do this for custom profile?
User-added image
I set up Navigation Topics and Featured Topics in Community Builder and upload banners and thumbnails with correct size.
But in the Home page of my Kokua Community, there's no image displayed.  Can someone here please help me?

Featured Topic without image
 
Hi,

Can anyone tell me what is Knowledge User checkbox in User detail screen used for?
I read a document says that : although we enable the Salesforce Knowledge, the Knowledges and Articles Management tabs are not visible. We have to tick the Knowledge User checkbox.
But Tab Visiblility is set up in profile only, not sure why related to Knowledge User checkbox.
I published an article to Customer Portal. But when I login to Customer Portal and select Knowledge tab , there is an error pop-up message says that:
"Severe error trying to refresh article listing: 886907620-42408 (-1868695002)"
 
My Customer Portal cannot display any articles here. Can you please help to give an instruction to fix this issue.
Hi Expert,

I'm writing searching function in javascript which allows to search accounts and display them to VF page by using apex:pageBlockTable
I use sforce.connection to query data. I get a list of accounts but i dont know how to pass them to apex:pageBlockTable. Please suggest how to this.
My code is below:
if(search != null) {
                sforce.connection.sessionId = '{!$Api.Session_ID}';
                try{ 
                    var query = "find \{" + search + "\}" + " in all fields RETURNING Account (id, name, billingstreet, billingcity, billingpostalcode)"; 
                    var result = sforce.connection.search(query); 
                    if (result) {
                    	var records = result.getArray("searchRecords");   
                        for (var i=0; i<records.length; i++) {
                           var record = records[i].record;
                         //need to pass value to apex table here

                         }
                                              
                    }
                }  
                catch(e) { 
                    alert('An Error has Occured. Error:' +e); 
                }
            }
Code for displaying account information in VF page:
 
<apex:pageBlockSection columns="1" id="pbs">
                            <apex:pageBlockTable value="{!accounts}" var="account" id="pbt">
                                <apex:column headerValue="Name">
                                    <apex:outputLink value="#" onclick="fillIn('{!account.Name}', '{!account.id}');closeWindow();">{!account.Name}</apex:outputLink>
                                </apex:column>
                                
                                <apex:column headerValue="City" value="{!account.BillingCity}"/>
                                <apex:column headerValue="Street" value="{!account.BillingStreet}"/>
                                <apex:column headerValue="Postcode" value="{!account.BillingPostalCode}"/>
                            </apex:pageBlockTable>
                    	</apex:pageBlockSection>




 
I set up Navigation Topics and Featured Topics in Community Builder and upload banners and thumbnails with correct size.
But in the Home page of my Kokua Community, there's no image displayed.  Can someone here please help me?

Featured Topic without image