• LanceCresswell
  • NEWBIE
  • 35 Points
  • Member since 2014


  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 9
    Replies
Hi,

On an IOS mobile device we need to allow a sales rep to enter an Opportunity and Line Items and then generate a merge document containing the captured data.  This all needs to be performed offline using the Mobile SDK.  Is this possible and if so what would be the best approach?

I was thinking of maybe rendering a Visualforce page as a pdf and saving it as a possible solution.

Any thoughts would be much appreciated.
Hi,

How do I get a workflow rule to fire when I have criteria such as...

(Account: Activation DateEQUALSTODAY) AND (Account: Provider StatusEQUALSInactive)

and for it to evaluate when...

Evaluate the rule when a record is created, and any time it’s edited to subsequently meet criteria

It needs to perform a field update to make the Provider Status Active whenever Today matches the Activation Date.  The rule is active and I thought this would work but it doesn't seem to be.

I was hoping not to have to write code for it.

Any ideas on the matter would be appreciated.

Regards
Lance Cresswell
Hi,

How do I ensure an AJAX update request finishes before users click elsewhere on the VF page?

Here's my VF code...

                        <apex:inputField value="{!s.Quantity}" style="width:70px" required="false">
                            <apex:actionsupport event="onchange" action="{!ApprovalRequired}" rerender="selected" status="actionStatusQuantity">
                                <apex:param value="{!s.PriceBookEntryId}" assignTo="{!toCurrent}" name="toCurrent"/>
                            </apex:actionsupport>
                            <apex:actionStatus id="actionStatusQuantity" startText="Calculating..." stopText=""/>                           
                        </apex:inputField>

This displays a processing message but does not stop users clicking elsewhere e.g. on a Save commandbutton, before it has completed.  I need it to complete and the rerender="selected" command to always run.

Regards
Lance Cresswell
Hi folks,

I am having an event sequencing problem with my VF page.

Behind the onchange event of an inputField I am making an actionsupport call to the ApprovalRequired Method in my controller.  This method saves the approval result into the NeedsApproval property used by a inputHidden field.
           
<apex:pageBlock title="Selected {!$ObjectType.Product2.LabelPlural}" id="selected">                  
    <apex:inputHidden value="{!NeedsApproval}" id="needsapproval"/>               
    <apex:pageblockTable value="{!shoppingCart}" var="s" id="ProdTable">
        <apex:column headerValue="{!$ObjectType.OpportunityLineItem.Fields.Quantity.Label}">
            <apex:inputField value="{!s.Quantity}" style="width:70px" required="false">
                <apex:actionsupport event="onchange" action="{!ApprovalRequired}" rerender="selected">
                    <apex:param value="{!s.PriceBookEntryId}" assignTo="{!toCurrent}" name="toCurrent"/>                       
                </apex:actionsupport>                           
            </apex:inputField>
        </apex:column>
    </apex:pageblockTable>
</apex:pageBlock>

Further up the page the Save button calls an approvalReq js method

    <apex:commandButton action="{!onSubmitAll}" value="Save" onclick="if(!approvalReq()) return false;" style="width:60px"/>

This method checks the value found in the needsapproval element and displays a message stating that approval is required, do you wish to continue? If they do then the SubmitAll method is called.

The problem is if the user clicks the Save button immediately after entering a value in the quantity field the ApprovalRequired controller method has not fired or finished and so the approvalReq js method then picks up the previous value in the needsapproval element and not the latest.

The ApprovalRequired controller method logic is too difficult to right in js (as it uses custom settings etc) and so I'm not sure what the best approach is here.

Any help would be much appreciated.

Regards
Lance Cresswell
This js getElementById command is working when accessing an element under a tag...

            <apex:pageBlock title="Selected {!$ObjectType.Product2.LabelPlural}" id="selected">                  
                   <apex:inputHidden value="{!NeedsApproval}" id="needsapproval"/>

by using the following js in a function called from a button click...

            var text = document.getElementById('{!$Component.mainpage.mainform.selected.needsapproval}').value;

Now when trying to access an value from an apex:inputField within an apex:pageblockTable under the same apex:pageblock I am unable to get the value.

Here's the VF...

            <apex:pageBlock title="Selected {!$ObjectType.Product2.LabelPlural}" id="selected">                  
                   <apex:inputHidden value="{!NeedsApproval}" id="needsapproval"/>               
                   <apex:pageblockTable value="{!shoppingCart}" var="s" id="ProdTable">              
                        <apex:column headerValue="{!$ObjectType.OpportunityLineItem.Fields.Approval_Level__c.Label}" id="level">                   
                            <apex:inputField value="{!s.Approval_Level__c}" style="width:20px" />
                        </apex:column>                   
                   </apex:pageblockTable>
            </apex:pageBlock>

And here is the js command that does not work when called from the same method when 1 record exists in the table...

var text = document.getElementById('{!$Component.mainpage.mainform.selected.ProdTable.0.level}').value;

I think I'm referencing the element correctly based on the source behing the VF page.

Can anyone see what am I doing wrong here?

Regards
Lance Cresswell
Hi folks,

I am having an event sequencing problem with my VF page.

Behind the onchange event of an inputField I am making an actionsupport call to the ApprovalRequired Method in my controller.  This method saves the approval result into the NeedsApproval property used by a inputHidden field.
           
<apex:pageBlock title="Selected {!$ObjectType.Product2.LabelPlural}" id="selected">                  
    <apex:inputHidden value="{!NeedsApproval}" id="needsapproval"/>               
    <apex:pageblockTable value="{!shoppingCart}" var="s" id="ProdTable">
        <apex:column headerValue="{!$ObjectType.OpportunityLineItem.Fields.Quantity.Label}">
            <apex:inputField value="{!s.Quantity}" style="width:70px" required="false">
                <apex:actionsupport event="onchange" action="{!ApprovalRequired}" rerender="selected">
                    <apex:param value="{!s.PriceBookEntryId}" assignTo="{!toCurrent}" name="toCurrent"/>                       
                </apex:actionsupport>                           
            </apex:inputField>
        </apex:column>
    </apex:pageblockTable>
</apex:pageBlock>

Further up the page the Save button calls an approvalReq js method

    <apex:commandButton action="{!onSubmitAll}" value="Save" onclick="if(!approvalReq()) return false;" style="width:60px"/>

This method checks the value found in the needsapproval element and displays a message stating that approval is required, do you wish to continue? If they do then the SubmitAll method is called.

The problem is if the user clicks the Save button immediately after entering a value in the quantity field the ApprovalRequired controller method has not fired or finished and so the approvalReq js method then picks up the previous value in the needsapproval element and not the latest.

The ApprovalRequired controller method logic is too difficult to right in js (as it uses custom settings etc) and so I'm not sure what the best approach is here.

Any help would be much appreciated.

Regards
Lance Cresswell
Hi,

How do I get a workflow rule to fire when I have criteria such as...

(Account: Activation DateEQUALSTODAY) AND (Account: Provider StatusEQUALSInactive)

and for it to evaluate when...

Evaluate the rule when a record is created, and any time it’s edited to subsequently meet criteria

It needs to perform a field update to make the Provider Status Active whenever Today matches the Activation Date.  The rule is active and I thought this would work but it doesn't seem to be.

I was hoping not to have to write code for it.

Any ideas on the matter would be appreciated.

Regards
Lance Cresswell
Hi folks,

I am having an event sequencing problem with my VF page.

Behind the onchange event of an inputField I am making an actionsupport call to the ApprovalRequired Method in my controller.  This method saves the approval result into the NeedsApproval property used by a inputHidden field.
           
<apex:pageBlock title="Selected {!$ObjectType.Product2.LabelPlural}" id="selected">                  
    <apex:inputHidden value="{!NeedsApproval}" id="needsapproval"/>               
    <apex:pageblockTable value="{!shoppingCart}" var="s" id="ProdTable">
        <apex:column headerValue="{!$ObjectType.OpportunityLineItem.Fields.Quantity.Label}">
            <apex:inputField value="{!s.Quantity}" style="width:70px" required="false">
                <apex:actionsupport event="onchange" action="{!ApprovalRequired}" rerender="selected">
                    <apex:param value="{!s.PriceBookEntryId}" assignTo="{!toCurrent}" name="toCurrent"/>                       
                </apex:actionsupport>                           
            </apex:inputField>
        </apex:column>
    </apex:pageblockTable>
</apex:pageBlock>

Further up the page the Save button calls an approvalReq js method

    <apex:commandButton action="{!onSubmitAll}" value="Save" onclick="if(!approvalReq()) return false;" style="width:60px"/>

This method checks the value found in the needsapproval element and displays a message stating that approval is required, do you wish to continue? If they do then the SubmitAll method is called.

The problem is if the user clicks the Save button immediately after entering a value in the quantity field the ApprovalRequired controller method has not fired or finished and so the approvalReq js method then picks up the previous value in the needsapproval element and not the latest.

The ApprovalRequired controller method logic is too difficult to right in js (as it uses custom settings etc) and so I'm not sure what the best approach is here.

Any help would be much appreciated.

Regards
Lance Cresswell
This js getElementById command is working when accessing an element under a tag...

            <apex:pageBlock title="Selected {!$ObjectType.Product2.LabelPlural}" id="selected">                  
                   <apex:inputHidden value="{!NeedsApproval}" id="needsapproval"/>

by using the following js in a function called from a button click...

            var text = document.getElementById('{!$Component.mainpage.mainform.selected.needsapproval}').value;

Now when trying to access an value from an apex:inputField within an apex:pageblockTable under the same apex:pageblock I am unable to get the value.

Here's the VF...

            <apex:pageBlock title="Selected {!$ObjectType.Product2.LabelPlural}" id="selected">                  
                   <apex:inputHidden value="{!NeedsApproval}" id="needsapproval"/>               
                   <apex:pageblockTable value="{!shoppingCart}" var="s" id="ProdTable">              
                        <apex:column headerValue="{!$ObjectType.OpportunityLineItem.Fields.Approval_Level__c.Label}" id="level">                   
                            <apex:inputField value="{!s.Approval_Level__c}" style="width:20px" />
                        </apex:column>                   
                   </apex:pageblockTable>
            </apex:pageBlock>

And here is the js command that does not work when called from the same method when 1 record exists in the table...

var text = document.getElementById('{!$Component.mainpage.mainform.selected.ProdTable.0.level}').value;

I think I'm referencing the element correctly based on the source behing the VF page.

Can anyone see what am I doing wrong here?

Regards
Lance Cresswell