Skip to Content
0

Formatted search, more than one fields that trigger the formatted search

Jan 29 at 10:30 AM

71

avatar image
Former Member

Hi all,

I have a formatted search that refresh my UDF to 0 whenever the "Document Total" change.

The reason behind it is to work with the stored procedures. Stored procedure will stop user adding Purchase Order, if they haven't save as draft. When user "saved as draft" the UDF will become 1, hence user can add the draft.

My formatted search is to make sure user to "save as draft" once they have changed the united price/quantity.

Now my situation is i want user to "saved as draft" again when the "department", "division" and "subject" have any changes.

because for the formatted search, i can only choose one field to trigger my formatted search. Is there any way to solve my problem?

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Johan Hakkesteegt Jan 29 at 11:27 AM
0

Hi James,

You could use the query that you use to determine if a document was "saved as draft", directly in the stored procedure, instead of with a FMS first.

In the stored procedure you can then write all other conditions as well, like department was changed, etc.

regards,

Johan

Show 9 Share
10 |10000 characters needed characters left characters exceeded
Former Member

my formatted search is basically updating my UDF to 0, and my stored procedure is to update the UDF to 1 when save as draft and can't be save as draft when the UDF is 0.

I have set my formatted search refresh when my "Document Total" has any change.

is there a way to solve my problem apart from re-doing the stored procedure and formatted search?

thanks!

0

Hi James,

Unfortunately B1 does not allow for multiple triggers for an FMS. I don't think there are any better options than to add conditions to the stored procedure.

You can add the new logic to the query to check when the UDF value is 1

Regards,

Johan

1
Former Member
Johan Hakkesteegt

Thanks for the reply,

U said that in stored procedure i can write condition like department was changed?

Could you please tell me how to do it?

Regards,

James

0

Hi James,

Please post your stored procedure query, and we can try to edit it.

Regards,

Johan

0
Former Member
Johan Hakkesteegt

if @object_type ='112' and @transaction_type in ('A' , 'U')

begin

IF (SELECT ObjType FROM ODRF WHERE DocEntry = @list_of_cols_val_tab_del) = 22

UPDATE ODRF SET U_PODraft = 1

WHERE DocEntry = @list_of_cols_val_tab_del

end

-------------------block PO without save as DRAFT

if @object_type ='22' and @transaction_type in ('A')

begin

DECLARE @CheckValue nvarchar(10)

SET @CheckValue = (

select

'Y'

from OPOR t0

WHERE DocEntry = @list_of_cols_val_tab_del and isnull(U_PODraft,'0') <> '0')

IF @CheckValue ='Y'

SET @error = 0

ELSE

SET @error = '22'

set @error_message = 'Please RIGHT click save as Draft first'

END

0

Hi James,

Just a question to clarify your scenario: This code will only allow the user to create a PO from a draft. Is this on purpose? Is your process that a user first adds a draft and then opens that draft to save it as a real PO?

You can see changes in the history log, and you can duplicate a PO. What is the added value of the draft?

Regards,

Johan

0
Show more comments