0

我正在将文件附加到订单上的注释中。

要求是,一旦附加文件,其名称应按订单号更新

例如,如果文件名是latestOrders.csv,订单号是,ABC-123-XYZ那么附加文件名后应该保存为

   ABC-123-XYZ - latestOrders.csv

有什么办法可以完成吗?

4

1 回答 1

1

您可以在注释上编写预创建插件来处理此要求。确定正在创建的注释是否为 1) 附件和 2) 与订单相关。如果两者都为真,则修改该filename属性。这是逻辑的超级快速代码示例。

if (entity.LogicalName == "annotation" && entity.GetAttributeValue<bool>("isdocument") == true && entity.GetAttributeValue<string>("objecttypecode") == "salesorder")
{
    //I'm assuming you'll write a method to get the order number/name
    var newFilename = GetEntityName(entity.Attributes["objectid"] as EntityReference, entity.Attributes["filename"] as string);
    entity.Attributes["filename"] = newFilename;
}
于 2016-05-27T17:55:33.410 回答