Solved

Add media items to MWO - adhoc purchasing

  • 18 October 2023
  • 4 replies
  • 80 views

Badge +2

I have been trying to modify mwo in cust layer as an implementation and found this issue when i try to add a mediaselecter to an existing assistant.

I’m checking if this is not completely possible or if this is due to my implementation issue.

Customer is in 22R2 and in the code base the implementation is null for the function i’ve used from the eformsapp core file.

FUNCTION Create_And_Connect_Media___ (
   lu_name_ IN VARCHAR2,
   key_ref_ IN VARCHAR2,
   name_    IN VARCHAR2 ) RETURN Fnd_Media_Keys_Rec
IS
   
BEGIN
   NULL;
END Create_And_Connect_Media___;

Can i know the error is due to this or any other reason?

implemetation is like following

in the AdHocPurchaseRequestAssistant (overtaken in cust)

fileselector MediaFileSelector {
         enabled = [true];
         --[MediaEnabled = true];
         multifile = [true];
         init command {
            execute {
               call GetMediaFileExtensions() into component.MediaFileSelector.AcceptedExtensions;
            }
         }
         label = "Attach Media Items";
      }

finish command (moved inside) in the same assistant 

execute {

         call IsProductReviewListEmpty(ReferenceNo) into IsEmpty;

         if[IsEmpty = "TRUE"] {
            error("Cannot finish Ad-hoc request without a part line.");
         }
         else {
            call CreateAdhocReceipt(ReferenceNo, WorkTaskNo, Contract, VendorNo, CurrencyCode, ReceiptReference, SelfBillingEnabled);
            if [ReferenceNo != null] {
               set KeyRef = "REFERENCE_NO=${ReferenceNo}^";
               set LuName = "AdhocPurchRequest";
            }
            if[component.MediaFileSelector.IsEmpty != null] {
               upload "MediaItemSet(ItemId=$[MediaKeys.ItemId])/MediaObject" from MediaFileSelector {
                  call CreateAndConnectMedia(LuName, KeyRef, component.MediaFileSelector.UploadingFile) into MediaKeys;
               }
               refresh;
               navigate back;
            }
         }
      }

 

 

icon

Best answer by dirolk 20 October 2023, 10:08

View original

4 replies

Badge

Hi,
Attaching media item in a step is supported in assistants.
Error can can be due to the action body of CreateAndConnectMedia is empty. Since the value for MediaKeys.ItemId is set, once it returned the data from CreateAndConnectMedia.

Best Regards,
Dileepa

Badge +2

Thank you for the reply. In 22R2 version in cloud that same implementation for the method is null in the core file.

FUNCTION Create_And_Connect_Media___ (
   lu_name_ IN VARCHAR2,
   key_ref_ IN VARCHAR2,
   name_    IN VARCHAR2 ) RETURN Fnd_Media_Keys_Rec
IS
   
BEGIN
   NULL;
END Create_And_Connect_Media___;
is there any latest implementation for this in a newer version of IFS  like 23R1?

but the mobile flow works fine when we raise service request and attach media (core implemented solution)

I used the same block of code, Enabled object connections on AdhocPurchRequest LU and used the same implementation but in my case it doesn’t work. I want to know if there’s is another setting or an implementation we need to implement additionally to make it work or this is not possible at all.

 

Badge

Hi,
You have to implement the action body in offline file like below.

@Overtake Core
procedure Action<CreateAndConnectMedia> Structure(FndMediaKeys) {
parameter LuName Text;
parameter KeyRef Text;
parameter Name Text;
variable MediaKeys Structure(FndMediaKeys);
variable Result List<Text>;
variable Counter Number;
variable StringCombined Text;
variable CurrentTaskNo Text;
variable NoOfKeyRefs Number;
variable KeyRefsList List<TEXT>;
variable ListCount Number;
execute {
call String.RegexCount(KeyRef, "&") into NoOfKeyRefs;
if [NoOfKeyRefs = 0] {
call Attachment.CreateAndConnectMedia(LuName, KeyRef, Name) into MediaKeys;
}
else {
call String.Tokenize(KeyRef, "&") into KeyRefsList;
call List.Count(KeyRefsList) into ListCount;
set Counter = 0;
while [Counter < ListCount] {
call List.Get(KeyRefsList, Counter) into KeyRef;
if[Counter = 0]
{
call Attachment.CreateAndConnectMedia(LuName, KeyRef, Name) into MediaKeys;
}
else
{
call Attachment.ConnectMedia(MediaKeys, LuName, KeyRef);
}
set Counter = [Counter+1];
}
}
return MediaKeys;
}
}

Best Regards,

Dileepa

Badge +2

Thank you @dirolk 

This works. It’s tested and works fine.

Can i know if this block of code is implemented somewhere in the core implementation of latest version or a code you came up with to resolve this specific issue?

Reply