No Pattern Match portion works fine.
I pull a value from a database that looks like 'John Smith-NS'.
I fill a field using the Java Script called Project Manager with the value 'John Smith' as a result from the Java Script code.
However I now want to use the Project Manager Field as a variable in my Stored Procedure to lookup the Username from cf_users. So I pass Project Manager as the displayname using a variable in my stored procedure and the value of '1' for is_domainaccount to return DOMAIN\jsmith. I tested my stored procedure and it works fine ( I actually use others on this form that work like a charm) but nothing gets returned to my Field called Domain Account. It seems like when I pass the Project Manager Field which is displaying 'John Smith' no value is being passed to the Stored Procedure.
USE [Lindsay_LFForms]
GO
/****** Object: StoredProcedure [dbo].[sp_Lindsay_PO_cf_users_DomainAccount] Script Date: 08/20/2015 11:11:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[sp_Lindsay_PO_cf_users_DomainAccount]
@DisplayName varchar(50)
AS
BEGIN
SELECT *
FROM [Lindsay_LFForms].[dbo].[cf_users] where is_domainaccount = '1' and displayname = @DisplayName
END

So instead I thought I will just do a normal LookUp Rule


I now get an autofill box. So I use the code and assign to CSS class to have the autofill box automatically click.
$(document).ready(function () {
function autofill() {
$('.autofill').trigger('click');
}
$('.lookupCondition').change(autofill);
});
This works elsewhere on other forms however my Domain Account in this case will not fill in until I manually click the autofill box.
I thought perhaps the reason neither of these are working is because I am populating the Project Manager field using JavaScript so the value is not being recognized as there has been no click, blur or any other event.
Optimally I would like to use the Stored Procedure as it avoids the autofill button and hidden fields but just find this strange as I have done both SP and Autofill before without problems the only thing different is the field is being populated as the result of JavaScript.