`
sjkgxf7191
  • 浏览: 251817 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

Force.com 云计算平台 试玩小结(三)

阅读更多

最大的不便:只能用Flash Builder 4构建基于桌面的AIR程序 ,基于Web的Flex应用暂时还不支持 。。。


 

Tutorial #5: Adding Business Logic with Apex

  • Apex是运行在Force.com上强类型面向对象 的编程语言。
  • 你可以用Apex来编写触发器(trigger)web servicesprogram controllers
  • 可以用Apex来编写一些复杂的事务逻辑
  • 商品(Merchandise)price降低的时候,Invoice Statement 和 Line Item会作出相应的变化。
  • Setup->Create->Objects->Triggers->New

Step 2: Define a List Variable

 

trigger HandleProductPriceChange on Merchandise__c (after update) {
    List<Line_Item__c> openLineItems =
    [SELECT j.Unit_Price__c, j.Merchandise__r.Price__c
        FROM Line_Item__c j
        WHERE j.Invoice_Statement__r.Status__c = 'Negotiating'
        AND j.Merchandise__r.id IN :Trigger.new
        FOR UPDATE];
        
    for (Line_Item__c li: openLineItems) {
    if ( li.Merchandise__r.Price__c < li.Unit_Price__c ){
        li.Unit_Price__c = li.Merchandise__r.Price__c;
        }
    }
    update openLineItems;
}


Tutorial #7: Building a Custom User Interface Using Visualforce

 

Step 1: Enable Visualforce Development Mode

 

Setup->My Personal Information->Personla Information->Edit->Development Mode


Step 2: Create a Visualforce Page

 

https://na1.salesforce.com/apex/CountSheet

 

Tutorial #8: Creating a Public Web Page Using Force.com Sites

 

Step 1: Create a Product Catalog Page

 

Setup->Develop->Pages

 

<apex:page standardstylesheets="false" showHeader="false" sidebar="false" standardController="Merchandise__c" recordSetVar="products" >
<apex:stylesheet value="{!URLFOR($Resource.styles, 'styles.css')}"/>
    <h1>Merchandise Catalog</h1>
    <apex:datatable value="{!products}" var="pitem" rowClasses="odd,even">
        <apex:column headerValue="Product">
            <apex:outputtext value="{!pitem.name}" />
        </apex:column>
        <apex:column headerValue="Description">
            <apex:outputField value="{!pitem.Description__c}"/>
        </apex:column>
        <apex:column headerValue="Price">
            <apex:outputField value="{!pitem.Price__c}"/>
        </apex:column>
    </apex:datatable>
</apex:page>
 

Step 2: Register a Force.com Domain Name

 

Setup->Develop->Sites->Register My Force.com Domain->Public Access Settings->Edit->Read permission for the Merchandise object

  • 大小: 24 KB
1
0
分享到:
评论
1 楼 Cecily 2010-04-11  
workbook啊

相关推荐

Global site tag (gtag.js) - Google Analytics