多态(Polymorphic) 在Power Apps Canvas中处理

发布时间 2023-06-01 13:57:56作者: TheMiao

在dataverse,我们可以创建Regarding,Customer 或者Owner类似的多态的字段,这样方便lookup查询不同表的数据

但是在canvas当中,我们注意这些多态lookup字段是需要确认type类型。所以这边我们要用istype来判断,然后在通过AsType获取值。

 

If( IsType( First( Accounts ).Owner, Users ),
    AsType( First( Accounts ).Owner, Users ).'Full Name',
    AsType( First( Accounts ).Owner, Teams ).'Team Name'
)